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

Created on 27 Jul 2020  Β·  7Comments  Β·  Source: nodejs/node

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.

  • Version: 12.18.3
  • Platform: linux 5.4.51-v7l+ #1327 SMP Thu Jul 23 11:04:39 BST 2020 armv7l GNU/Linux
  • Hardware: Raspberry Pi 4 / 4 GB

npm list
/root
β”œβ”€β”¬ @iekedemus/[email protected]
β”‚ └── [email protected]
β”œβ”€β”€ [email protected]
└── [email protected]

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

duplicate npm

Most helpful comment

@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:

All 7 comments

See https://github.com/nodejs/help/issues/2871, https://github.com/nodejs/help/issues/2874, https://github.com/nodejs/node/issues/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.

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

I have the same problem

@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:

@iamstarkov The problem is the [email protected] (hardcoded in your package.json, no semver range) β†’ @semantic-release/npm@^5.2.0-beta.5 β†’ [email protected] (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.

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.

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danialkhansari picture danialkhansari  Β·  3Comments

sandeepks1 picture sandeepks1  Β·  3Comments

Icemic picture Icemic  Β·  3Comments

loretoparisi picture loretoparisi  Β·  3Comments

vsemozhetbyt picture vsemozhetbyt  Β·  3Comments