折腾:
【未解决】gitbook安装和使用插件autocover给生成的pdf文件加上封面
期间,去
make deubg
期间gitbook报错:
gitbook --port 4000 --lrport 35729 serve /Users/xxx/dev/crifan/gitbook/gitbook_template/books/python_newbie_mistakes_questions /Users/xxx/dev/crifan/gitbook/gitbook_template/generated/books/python_newbie_mistakes_questions/debug --log debug Live reload server started on port: 35729 Press CTRL+C to quit ... debug: readme found at README.md debug: summary file found at SUMMARY.md debug: cleanup folder "/Users/xxx/dev/crifan/gitbook/gitbook_template/generated/books/python_newbie_mistakes_questions/debug" /usr/local/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 /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18 at FSReqCallback.oncomplete (node:fs:195:5) make: *** [debug] Error 1
polyfills.js TypeError cb.apply is not a function
试试:
npm install graceful-fs --save-dev
log
npm install graceful-fs --save-dev added 1 package, and removed 74 packages in 2s
结果:
问题依旧。
node -v v15.6.0 npm -v7.4.0
cd /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules npm install graceful-fs@latest --save
log
cd /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/ npm install graceful-fs@latest --save npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). npm WARN deprecated [email protected]: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues. npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). npm WARN deprecated [email protected]: this library is no longer supported npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor. npm WARN deprecated [email protected]: several bugs fixed in v3.2.1 npm WARN deprecated [email protected]: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues. npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen) added 271 packages, and changed 3 packages in 11s
结果:
解决了问题。
【总结】
此处是gitbook下面的npm中的插件graceful-fs报错的:
/usr/local/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
而这个错误是:graceful-fs
之前的老版本的错误。最新版已修复。
解决办法:
去给gitbook-cli中安装最新版的graceful-fs
步骤:
cd /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/ npm install graceful-fs@latest --save
即可。
转载请注明:在路上 » 【已解决】gitbook出错:npm node_modules graceful-fs polyfills.js TypeError cb.apply is not a function