You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When publishing a package without scripts npm will warn that the errors were corrected in the published package.json, and that they can be fixed in the source package json with npm pkg fix.
npm WARN publish npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors.
npm WARN publish errors corrected:
npm WARN publish Removed invalid "scripts"
However, running npm pkg fix does not make any changes to package.json and publishing will print the same warning.
The "Removed invalid "scripts"" warning has been discussed and closed before. I think they were closed because npm maintainers justified the warning, but the ineffective advice to run npm pkg fix has not been addressed.
npm pkg fix should add "scripts": {} to package.json, or the warning should be removed for scripts.
Steps To Reproduce
~/tmp » cat package.json
{
"name": "tmp",
"version": "1.0.0"
}
~/tmp » npx npm@10.3.0 publish --dry-run
npm WARN publish npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors.
npm WARN publish errors corrected:
npm WARN publish Removed invalid "scripts"
npm notice
npm notice 📦 tmp@1.0.0
npm notice === Tarball Contents ===
npm notice 42B package.json
npm notice 41B ws/package.json
npm notice 138B ws/ws-1.0.0.tgz
npm notice === Tarball Details ===
npm notice name: tmp
npm notice version: 1.0.0
npm notice filename: tmp-1.0.0.tgz
npm notice package size: 344 B
npm notice unpacked size: 221 B
npm notice shasum: 26433916c42a0bb86db80fa9b56874a71193607f
npm notice integrity: sha512-xYYLg2OHl4Syb[...]V0h8JULEXt3Zw==
npm notice total files: 3
npm notice
npm WARN This command requires you to be logged in to https://registry.npmjs.org/ (dry-run)
npm notice Publishing to https://registry.npmjs.org/ with tag latest and default access (dry-run)
+ tmp@1.0.0
~/tmp » npx npm@10.3.0 pkg fix
~/tmp » cat package.json
{
"name": "tmp",
"version": "1.0.0"
}
Environment
npm: 10.3.0 (and 10.2.30
Node.js: N/A (18.19.0)
OS Name: Ubuntu
System Model Name: What
npm config:
; node bin location = ~/.local/share/rtx/installs/node/18.19.0/bin/node; node version = v18.19.0; npm local prefix = ~tmp; npm version = 10.2.3; cwd = ~/tmp; HOME = ~/; Run `npm config ls -l` to show all defaults.
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
When publishing a package without scripts npm will warn that the errors were corrected in the published package.json, and that they can be fixed in the source package json with
npm pkg fix
.However, running
npm pkg fix
does not make any changes to package.json and publishing will print the same warning.The "Removed invalid "scripts"" warning has been discussed and closed before. I think they were closed because npm maintainers justified the warning, but the ineffective advice to run npm pkg fix has not been addressed.
#6918
#6887
Expected Behavior
npm pkg fix
should add"scripts": {}
to package.json, or the warning should be removed for scripts.Steps To Reproduce
Environment
The text was updated successfully, but these errors were encountered: