-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
When /proc/stat and /proc/cpuinfo are not accessible and version 1 package-lock.json is present, npm ci fails to install packages with "exit handler never called" error after "The package-lock.json file was created with an old version of npm" warning. This is caused by a bug in promise-call-limit library.
To check whether the system is affected by the bug one can run this command:
node -e "console.log(require('os').cpus())"If it prints an empty list [] then there is a bug and npm will fail either at idealTree:inflate stage or at build:run:* stage. This is caused by a bug in callLimit function that doesn't run any of the passed functions if CPU count cannot be determined. This function is invoked in two places: when parsing old lock file and when running build:run.
I have made a pull request to fix the bug: isaacs/promise-call-limit#11 . Please consider updating promise-call-limit version.
So, the bug only happens if /proc not being accessible and stage is idealTree:inflate (and old lockfile is present) or build:run:*.
Searching around shows that there are bugs from users trying to use npm in different OSes which might be caused by the same reason:
- [BUG] Exit handler never called! #5488 (bug on idealTree:inflate stage when parsing lockfile version 1 on Android)
- [BUG] svelte-prepocess install fails : npm ERR! Exit handler never called! #4839 (bug on build:run:postinstall stage in OpenBSD)
- NPM BUG #4719 (bug when parsing lockfile version 1 but OS is not specified by user)
- [BUG] npm install not working #6213 (old lockfile, OS unknown)
- [BUG v8] <npm Problem> #6076 (old lockfile, OS unknown)
- [BUG] Exit handler never called during one-time lock update #6017 (old lockfile, Android)
- [EXIT HANDLER NEVER CALLED] While installing dependencies using NPM v8.19.2 on ARMv8 #5886 (Android, log not published)
- [BUG]
Exit handler never called!When trying to installcode-server#5841 (Android, build:run:install stage) - npm WARN old lockfile npm WARN old lockfile The package-lock.json file was created with an old version of npm, npm WARN old lockfile so supplemental metadata must be fetched from the registry. npm WARN old lockfile npm WARN old lockfile This is a one-time fix-up, please be patient... npm WARN old lockfile npm ERR! Exit handler never called! npm ERR! This is an error with npm itself. Please report this error at: npm ERR! <https://github.com/npm/cli/issues> npm ERR! A complete log of this run can be found in: npm ERR! /data/data/com.termux/files/home/.npm/_logs/2022-06-25T06_50_41_240Z-debug-0.log #5080 (Android and old lock file)
- there are more closed issues but I'm a bit tired of looking through them
These users should run the command above to check whether their issue is caused by this bug.
Expected Behavior
npm ci runs successfully without errors
Steps To Reproduce
- Create a container without /proc mounted or unmount /proc or use OS without /proc
- Run
node -e "console.log(require('os').cpus())"and see that it prints[] - Create a directory and create a package-lock.json with following contents:
{
"name": "test-npm-bug",
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"@nodelib/fs.stat": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
"integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A=="
}
}
}
Also create package.json:
{
"name": "test-npm-bug",
"dependencies": {
"@nodelib/fs.stat": "2.0.5"
}
}- Run npm ci --ddd
- See messages in log:
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm verb unfinished npm timer command:ci 1680276840213
npm verb unfinished npm timer idealTree 1680276840284
npm verb unfinished npm timer idealTree:inflate 1680276840288
npm info ok
npm ERR! Exit handler never called!
Environment
- npm: 9.6.3
- Node.js: v18.15.0
- OS Name: Linux
- System Model Name:
- npm config:
; node bin location = /usr/bin/node
; node version = v18.15.0
; npm local prefix = /shared/test-npm
; npm version = 9.6.3
; cwd = /shared/test-npm
; HOME = (removed)
; Run `npm config ls -l` to show all defaults.