问题:
1 2 3 4 5 6 7 8 9 10 11 |
hbwb12711-2:mybook jia$ gitbook serve Live reload server started on port: 35729 Press CTRL+C to quit ... /Users/jia/.nvm/versions/node/v12.22.11/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287 if (cb) cb.apply(this, arguments) ^ TypeError: cb.apply is not a function at /Users/jia/.nvm/versions/node/v12.22.11/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18 at FSReqCallback.oncomplete (fs.js:169:5) |
原因:
nodejs的版本不对,不支持这个gitbook
解决:
方案一:
安装并切换到v10.21.0
,然后重新安装gitbook-cli
方案二:
找到polyfills.js,注释如下代码
1 2 3 |
// fs.stat = statFix(fs.stat) // fs.fstat = statFix(fs.fstat) // fs.lstat = statFix(fs.lstat) |