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

TypeError: cb.apply is not a function #192

Closed
buxoman opened this issue Jul 7, 2020 · 11 comments
Closed

TypeError: cb.apply is not a function #192

buxoman opened this issue Jul 7, 2020 · 11 comments

Comments

@buxoman
Copy link

buxoman commented Jul 7, 2020

% 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

  • graceful-fs@4.2.4
    added 1 package in 0.252s

% 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
Copy link

yberstad commented Jul 8, 2020

Hi!

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

@buxoman
Copy link
Author

buxoman commented Jul 8, 2020

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

@coreyfarrell
Copy link
Collaborator

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
Copy link

yberstad commented Jul 8, 2020

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

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

@coreyfarrell
Copy link
Collaborator

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
Copy link

willin commented Aug 6, 2020

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
Copy link

willin commented Aug 6, 2020

@greyltc
Copy link

greyltc commented Aug 6, 2020

Yeah. That also doesn't work for me.

@greyltc
Copy link

greyltc commented Aug 11, 2020

If anyone has a working solution for this for the abandoned gitbook-cli, please let us know at GitbookIO/gitbook-cli#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
Copy link

MwumLi commented Feb 15, 2021

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
Copy link

synergiator commented May 22, 2021

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")

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

7 participants