Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
If you run a re-installation, changes occur in the package-lock file for a dependency from a local subdirectory - a “name” field for this dependency appears.
Expected Behavior
re-installation does not change the package-lock file:
- the name field should appear during the first installation.
- or the name field should not appear during re-installation.
Steps To Reproduce
- add local dependency in subdirectory
package.json
{
"dependencies": {
"wasm": "file:wasm/build"
}
}
wasm/build/package.json
{
"name": "wasm",
"version": "0.1.0"
}
npm i
lock-file is:
{
"name": "projectname",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"wasm": "file:wasm/build"
}
},
"node_modules/wasm": {
"resolved": "wasm/build",
"link": true
},
"wasm/build": {
"version": "0.1.0"
}
}
}
npm i again
now lock-file is:
{
"name": "projectname",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"wasm": "file:wasm/build"
}
},
"node_modules/wasm": {
"resolved": "wasm/build",
"link": true
},
"wasm/build": {
"name": "wasm",
"version": "0.1.0"
}
}
}
Environment
- npm: 10.3.0
- Node.js: v21.6.0
- OS Name: macOS 14.2.1 (23C71)
- System Model Name: Macbook Pro
- npm config:
; "user" config from /Users/username/.npmrc
//registry.npmjs.org/:_authToken = (protected)
auto-install-peers = true
; "project" config from /Users/username/git/projectname/.npmrc
engine-strict = true
; node bin location = /usr/local/bin/node
; node version = v21.6.0
; npm local prefix = /Users/username/git/projectname
; npm version = 10.3.0
; cwd = /Users/username/git/projectname
; HOME = /Users/username
; Run `npm config ls -l` to show all defaults.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
If you run a re-installation, changes occur in the package-lock file for a dependency from a local subdirectory - a “name” field for this dependency appears.
Expected Behavior
re-installation does not change the package-lock file:
Steps To Reproduce
package.json{ "dependencies": { "wasm": "file:wasm/build" } }wasm/build/package.json{ "name": "wasm", "version": "0.1.0" }npm ilock-file is:
{ "name": "projectname", "lockfileVersion": 3, "requires": true, "packages": { "": { "dependencies": { "wasm": "file:wasm/build" } }, "node_modules/wasm": { "resolved": "wasm/build", "link": true }, "wasm/build": { "version": "0.1.0" } } }npm iagainnow lock-file is:
{ "name": "projectname", "lockfileVersion": 3, "requires": true, "packages": { "": { "dependencies": { "wasm": "file:wasm/build" } }, "node_modules/wasm": { "resolved": "wasm/build", "link": true }, "wasm/build": { "name": "wasm", "version": "0.1.0" } } }Environment