When executing any gitbook command in the terminal, the following error is thrown:
/home/travis/.nvm/versions/node/v12.18.3/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 /home/travis/.nvm/versions/node/v12.18.3/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
at FSReqCallback.oncomplete (fs.js:169:5)
NOTE: This does not happen in node version v12.18.2 and is still happening in version v14.6.0
The gitbook-cli seems to not be working right now, failing because of their outdated graceful-fs dependency.
Any ideas how to fix this?
The issue was originally a problem inside
graceful-fsbut they solved it in this commit I believe.The problem is that GitBook is still using outdated dependencies that pull in versions of graceful-fs without the fix.
The solution I found was to update
graceful-fsinside gitbook like this:If you've installed gitbook globally by doing
npm install -g gitbook-clithen your path in macOS should be something like/usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules. Your path may differ depending on your OS or installation location.Run this:
Then try installing GitBook. It should have fixed the installing problem.