-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[BUG] License is missing for all dependencies in package-lock.json #7384
Comments
I can't reproduce this. The license isn't in the package lock even with ~/D/n/s/install $ rm -rf package-lock.json node_modules/;npx npm@10.2.0 install
> npx
> npm install
added 3 packages, and audited 4 packages in 653ms
found 0 vulnerabilities
~/D/n/s/install $ cat package.json
{
"dependencies": {
"semver": "^7.0.0"
}
}
~/D/n/s/install $ grep -i license package-lock.json
~/D/n/s/install $ npm view semver license
ISC
~/D/n/s/install $ The license hasn't consistently been in the package lock to the best of my recollection. In fact when we implemented npm 9 also doesn't put the license in the package-lock. ~/D/n/s/install $ rm -rf package-lock.json node_modules/;npx npm@next-9 install
> npx
> npm install
added 3 packages, and audited 4 packages in 3s
found 0 vulnerabilities
~/D/n/s/install $ grep -i license package-lock.json |
Thank you for testing this. I'm not sure this makes a difference but you did not clear your npm cache as I did. Also, what do you mean by "consistently" in "The license hasn't consistently been in the package lock"? In some versions it is present, in others it is not? |
This has the effect of adding licenses back into the lockfiles. Based on code in shrinkwrap.js and inventory.js, it appears that lockfiles are supposed to store the license. It's likely that in practice this behavior has not been consistent due to fetching of minifed manifests and packuments. I also attempted to remove the license code from shrinkwrap but that caused many more tests to break. Plus I believe this is the intended behavior, to have licenses in lockfiles based on bug reports like #7384
This has the effect of adding licenses back into the lockfiles. Based on code in shrinkwrap.js and inventory.js, it appears that lockfiles are supposed to store the license. It's likely that in practice this behavior has not been consistent due to fetching of minifed manifests and packuments. I also attempted to remove the license code from shrinkwrap but that caused many more tests to break. Plus I believe this is the intended behavior, to have licenses in lockfiles based on bug reports like #7384
Thanks @lukekarrys for fixing this ! Looking forward to v10.8.0. |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
With any NPM version higher than 10.3.0, all of my project's dependency packages are missing their "licence" property in package-lock.json.
Packages installed with NPM v10.3.0 or below do show their licence type in package-lock.json.
Expected Behavior
The package-lock.json file should state which licence type was chosen for each of my project's dependency packages.
Steps To Reproduce
npm cache clean -f
;npm install
-> All "license" properties had disappeared from the project's package-lock.json.
Environment
The text was updated successfully, but these errors were encountered: