Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
npm error `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm error
npm error Invalid: lock file's yaml@1.10.2 does not satisfy yaml@2.5.1
npm error Missing: yaml@1.10.2 from lock file
Expected Behavior
npm ci should install packages without exception
Steps To Reproduce
Download repro repository: https://github.com/Saibamen/npm-double-install-bug
- Delete
package-lock.json
npm install
npm ci
See errors
Building with commited lock file (created on Windows) and npm ci:

Building with fresh lock file, npm install and then npm ci

Annoying workarounds
Workaround v1

npm install
- Delete
node_modules
npm install
npm ci
Workaround v2
Just run npm install twice, no need to delete node_modules.

npm install
npm install
npm ci
Environment
- npm:
10.8.3
- Node.js:
20.17.0
- OS Name: Windows 10
- System Model Name:
10.0.19045.4894
- npm config:
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v20.17.0
; npm local prefix = C:\XXX\npm-double-install-bug
; npm version = 10.8.3
; cwd = C:\XXX\npm-double-install-bug
; HOME = C:\Users\YYY
; Run `npm config ls -l` to show all defaults.
Diff after running npm install second time:
diff --git a/package-lock.json b/package-lock.json
index 07842ff..4823f0c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1606,6 +1606,16 @@
}
}
},
+ "node_modules/eslint-plugin-svelte/node_modules/yaml": {
+ "version": "1.10.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
+ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/eslint-scope": {
"version": "7.2.2",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
@@ -3528,21 +3538,6 @@
}
}
},
- "node_modules/svelte-check/node_modules/yaml": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz",
- "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==",
- "dev": true,
- "license": "ISC",
- "optional": true,
- "peer": true,
- "bin": {
- "yaml": "bin.mjs"
- },
- "engines": {
- "node": ">= 14"
- }
- },
"node_modules/svelte-eslint-parser": {
"version": "0.41.1",
"resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-0.41.1.tgz",
@@ -3737,19 +3732,6 @@
"url": "https://github.com/sponsors/antonk52"
}
},
- "node_modules/tailwindcss/node_modules/yaml": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz",
- "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==",
- "dev": true,
- "license": "ISC",
- "bin": {
- "yaml": "bin.mjs"
- },
- "engines": {
- "node": ">= 14"
- }
- },
"node_modules/text-table": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@@ -4067,13 +4049,16 @@
"license": "ISC"
},
"node_modules/yaml": {
- "version": "1.10.2",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
- "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz",
+ "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==",
"dev": true,
"license": "ISC",
+ "bin": {
+ "yaml": "bin.mjs"
+ },
"engines": {
- "node": ">= 6"
+ "node": ">= 14"
}
},
"node_modules/yocto-queue": {
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Expected Behavior
npm cishould install packages without exceptionSteps To Reproduce
Download repro repository: https://github.com/Saibamen/npm-double-install-bug
package-lock.jsonnpm installnpm ciSee errors
Building with commited lock file (created on Windows) and
npm ci:Building with fresh lock file,
npm installand thennpm ciAnnoying workarounds
Workaround v1
npm installnode_modulesnpm installnpm ciWorkaround v2
Just run
npm installtwice, no need to deletenode_modules.npm installnpm installnpm ciEnvironment
10.8.320.17.010.0.19045.4894Diff after running
npm installsecond time: