I regularly use Gitbook, a little Node.js software used to generate an ebook from a set of markdown files.
I use it for my ebooks. Today I was trying to generate a PDF, running gitbook pdf .
, when I got a really weird error:
➜ ebook git:(master) ✗ gitbook pdf .
/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
cb.apply is not a function
. What does this even mean? And most importantly, why do I have this error now? I didn’t update the gitbook package recently, and I didn’t… Oh I think I updated the Node.js version I run. But I have no idea why this should be the problem. Maybe it is.
Anyway… the error comes from the /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js
file. This is the [graceful-js](https://www.npmjs.com/package/graceful-fs)
npm package, a “drop-in replacement for the built-in Node.js fs
module, making various improvements”, installed over 33 million times a week.
One of those improvements seems to break my workflow, today!
I don’t have a lot of time free to find out why my Node.js version gives problems with this application I didn’t create and this library.
I opened the file /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js
, where the error comes from.
#function