isaacs / node-graceful-fs

fs with incremental backoff on EMFILE
ISC License
1.27k stars 148 forks source link

TypeError: cb.apply is not a function #192

Closed buxoman closed 4 years ago

buxoman commented 4 years ago

% uname -a Darwin xpace7 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64

% npm install graceful-fs -g

% gitbook -V CLI version: 2.3.2 Installing GitBook 3.2.3 /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 (fs.js:177:5)

yberstad commented 4 years ago

Hi!

I'm having the same issue, @buxoman did you find a solution?

buxoman commented 4 years ago

@yberstad I have no experience on javascript and just want to write markdown using gitbook.

coreyfarrell commented 4 years ago

Your install of gitboot is not using graceful-fs@4.2.4 since you got this error from polyfills.js:287. From what I can tell it must be using 4.1.11 or older in one or more places. This might be fixed by reinstalling gitbook-cli, if not this is a bug where gitbook or one of its dependencies is pulling in a broken version of graceful-fs. This issue was fixed in graceful-fs@4.2.0.

yberstad commented 4 years ago

I fixed the issue by adding this to package.json (after devDependencies: {})

  "resolutions": {
    "**/graceful-fs": "^4.2.4"
  }
coreyfarrell commented 4 years ago

It looks like the gitbook CLI is abandoned by its developers in favor of a paid service, see https://github.com/GitbookIO/gitbook#%EF%B8%8F-deprecation-warning.

Since the graceful-fs bug was fixed nearly 4 years ago and does not require a semver-major bump nothing further can be done by us. I don't know if alternatives to gitbook exist, this might be worth researching if the current situation is untenable for you.

willin commented 4 years ago

I fixed the issue by adding this to package.json (after devDependencies: {})

  "resolutions": {
    "**/graceful-fs": "^4.2.4"
  }

not working https://travis-ci.org/github/willin/codewars.js.cool/jobs/715362713#L204

willin commented 4 years ago

https://github.com/willin/codewars.js.cool/blob/master/package.json

greyltc commented 4 years ago

Yeah. That also doesn't work for me.

greyltc commented 4 years ago

If anyone has a working solution for this for the abandoned gitbook-cli, please let us know at https://github.com/GitbookIO/gitbook-cli/issues/110 I'll try to make a fork of gitbook-cli it so that the community has something that continues to work, but today I'm unable to fix this.

MwumLi commented 3 years ago

The main reason is that fs.stat support bigint since node v10.5.0:
image

But before v10.5.0, fs.js - Loop :
image

After v10.5.0, fs.js - Loop :
image

The simplest method is limit node version, If your can change node version:

  "engines": {
    "node": ">=8.11.1 < 11.15.0"
  }

The once and for all method is to send a patch package for graceful-fs "stat" to support option for second param

synergiator commented 3 years ago

the "engines" patch does not work with the RN community android build, the error remains. Neither the above "resolutions" patch.

is there a way to validate the setting has been indeed applied? (as it was said above, "IF you can change node version")