Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible upgrade to node 12.x.x #2

Open
jgvictores opened this issue Jan 9, 2022 · 3 comments
Open

Possible upgrade to node 12.x.x #2

jgvictores opened this issue Jan 9, 2022 · 3 comments

Comments

@jgvictores
Copy link
Member

jgvictores commented Jan 9, 2022

Up till now, on node versions above v10.x.x (e.g. v12.22.8), we ran into:

graceful-fs/polyfills.js:287
      if (cb) cb.apply(this, arguments)
                 ^
TypeError: cb.apply is not a function

Inspired by https://www.it-swarm-es.com/es/node.js/gitbook-cli-install-error-typeerror-cb.apply-no-es-una-funcion-dentro-de-graceful-fs/818378930/, I've managed to consistently run typical commands on node v12.22.8 (for reference, npm@6.14.15).

Preparation:

mkdir p ~/tmp
cd ~/tmp
npm install gitbook-cli
npm install gitbook
cd node_modules/npm/node_modules/
npm install graceful-fs@4.2.0

Running commands:

~/tmp/node_modules/gitbook-cli/bin/gitbook.js install
~/tmp/node_modules/gitbook-cli/bin/gitbook.js build
~/tmp/node_modules/gitbook-cli/bin/gitbook.js serve

Notes:

Related:

@jgvictores
Copy link
Member Author

jgvictores commented Jan 9, 2022

  • This is just an example. I understand actual changes would be forking gitbook and updating some package.json to enforce graceful-fs@4.2.0.

Possibly the following (note gitbook repo, not gitbook-cli):
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/package.json#L34

Edit: Regarding npm on forks: https://stackoverflow.com/questions/40528053/npm-install-and-build-of-forked-github-repo

@PeterBowman
Copy link
Member

cd node_modules/npm/node_modules/

There is something missing here, the node_modules directory appears out of nowhere. But I followed this and could successfully install gitbook on latest node Docker image (current-alpine, i.e. v17):

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

@jgvictores
Copy link
Member Author

There is something missing here

npm install -g installs into /usr/local/lib, I omitted the -g flag to do local tests on the relative path.

Still, this is a hack. Actually touching the gitbook package.json would be the coolest solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants