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

node 12.18.3 fails with TypeError: cb.apply is not a function in graceful-fs #34529

Closed
marcelgsteiger opened this issue Jul 27, 2020 · 8 comments
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. npm Issues and PRs related to the npm client dependency or the npm registry.

Comments

@marcelgsteiger
Copy link

marcelgsteiger commented Jul 27, 2020

After upgrading my Raspberry Pi 4 today, my nodered app stopped operating. I get the error

TypeError: cb.apply is not a function
at ~/.node-red/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
at FSReqCallback.oncomplete (fs.js:169:5)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.

I then went back to 12.18.0 - which operates flawlessly, then to 12.18.2 with npm 6.14.5, this also works as expected.

npm list
/root
├─┬ @iekedemus/vulgar-fraction@1.0.0
│ └── greatest-common-divisor@1.0.0
├── graceful-fs@4.2.4
└── jsonata@1.8.3

Steps that caused the problem:

apt upgrade / apt update / npm update to current versions

Remarks:

I think this is a very recent issue but I do not know if I could reproduce it just by updating nodered. 25 packages were updated, including kernel and system firmware.

Regards
Marcel

@addaleax addaleax added duplicate Issues and PRs that are duplicates of other issues or PRs. npm Issues and PRs related to the npm client dependency or the npm registry. labels Jul 27, 2020
@addaleax
Copy link
Member

addaleax commented Jul 27, 2020

See nodejs/help#2871, nodejs/help#2874, #34162, etc. – you’re using an outdated version of npm. Updating the npm in your source tree (or updating the graceful-fs within it) should help here.

@marcelgsteiger
Copy link
Author

Thank you for your quick response. I've been using npm 6.14.5 . Upgrading to 6.14.7 (npm@latest) does not help here. The error persists with node 12.18.3 and vanishes as soon as I go back to 12.18.2 . graceful-fs is already on the latest version 4.2.4. So I believe one of the numerous changes between 12.18.2 and 12.18.3 causes the issue on my platform. I also tried npm 6.14.6 (mentioned as dependency in node 12.18.3) but I get the same error. Could this be specific to my platform or kernel version, perhaps a timing issue? Pls let me know if I can provide some additional information for reproducing/debugging.
Regards
Marcel

@iamstarkov
Copy link

I have the same problem

@iamstarkov
Copy link

iamstarkov commented Aug 5, 2020

@addaleax I know you may be hesitant to reopen this bug due to prior similar issues with npm and graceful-fs and I've seen them and encountered those issues myself, so I have reasons to believe its a new bug. Please hear me out if not for me but for hundreds of others who experiences the same issue, but do not report.

I've faced the same bug and updated to latest npm and pinned graceful-fs to the latest version in the yarn.lock and it didnt help. The only fix which worked is to downgrade to node 12.18.2. I'm together with @milprog and think that its a new bug and it is something else.

Project I struggled with is my company ui kit https://github.com/nordnet/ui/ with semantic-release enabled and as soon 12.8.3 was released and picked by travis release process broke.

Here is the verifiable points concluded from my investigation of broken releases of our ui kit:

@addaleax
Copy link
Member

addaleax commented Aug 5, 2020

@iamstarkov The problem is the semantic-release@16.0.0-beta.18 (hardcoded in your package.json, no semver range) → @semantic-release/npm@^5.2.0-beta.5npm@6.5.0 (also hardcoded, no semver range) dependency chain. Simply upgrading your dependencies should be enough. You may not want to rely on beta versions of tools anyway.

@iamstarkov
Copy link

I will definitely upgrade away from beta in the future.

Can you elaborate a bit more why this dependency chain is a problem? I don't understand why it stopped working in latest patch release of node. It's a patch release not a minor or a major one.

@addaleax
Copy link
Member

addaleax commented Aug 5, 2020

@iamstarkov Right, but graceful-fs (which is not just a dependency of npm, it’s actually shipped as part of the npm package) depends on Node.js internals in a way that does not follow semver. In particular, in this case, we started using a custom option for a file system operation inside of Node.js itself, and the monkey-patched fs module from graceful-fs did not recognize that option in earlier versions.

@prionkor
Copy link

Just a FYI, I am having similar problem with node 12 as well as 14 alpine docker containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. npm Issues and PRs related to the npm client dependency or the npm registry.
Projects
None yet
Development

No branches or pull requests

4 participants