Gitbook-cli install error TypeError: cb.apply is not a function inside graceful-fs

The issue was originally a problem inside graceful-fs but 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-fs inside gitbook like this:

If you've installed gitbook globally by doing npm install -g gitbook-cli then 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:

cd /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/
npm install graceful-fs@latest --save

Then try installing GitBook. It should have fixed the installing problem.