-
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] Unwxpwcted warning "Removed invalid scripts" on publish #6918
Comments
If you add an empty one, does it avoid the warning? |
With empty scripts - no warning. |
so how come your package has no scripts? you're not running any tests? |
I tested it completely before created this issue. |
Right, i mean, why don’t you have any scripts? |
Hnn, strange question. |
Every package needs tests, and the "test" script thus needs to be defined. In other words, virtually zero packages don't need scripts. |
This is other question. |
I don't believe you; I'd guess that 99% of packages in the world do use scripts. I agree that they're not mandatory and the issue should be fixed, but I also think the reason nobody found this before is because everybody has scripts :-) |
Please, download 100 random packaces from the nom.org and check - do they have scripts. Listen, this is not related to this issur at all, let's not not wast time. Scripts are not ,mandatory, so what the sense of this warning, annoy people? If you are member of npm dev team and you are decided that this is not a issue - please, close it, bit let's stop crazy discussion. |
lasr words: If user need scripts - he will use them, if not - not. Without reminders from
We need to add some fake scripts to make is happy? The single goal of this warning is to annoy and confuse people. |
This is a side effect of how npm has been publishing packuments this whole time. If you inspect the packages in the registry, you'll see they all have an empty The new logging is a byproduct of our attempts to make sure these two entries are in sync. The decision was made to NOT allow a change change to what's in the registry to minimize potential breaking changes for those who consume these packages. |
Makes sense to me! However, the warning |
Is not just "unclear", is wrong! This is because actually does not remove anything! |
It doesn’t from package.json, but it does from the packument in the published package. |
Explaining the background to the bug is useful for context. However, the end user will not expect a warning message when they have a perfectly valid package.json. Furthermore, a warning message that suggests running |
We definitely use scripts but we don't see why we should be bloating the npm registry, user We prefer to strip this before publishing. Some quick maths : we save the interwebs ±120 gigabytes of transfer each week by stripping all scripts from I don't see the point of this warning ... |
Without it, npm complains about it: ``` 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" ``` via npm/cli#6918 it looks like this is not going to be fixed, thus the change, which removes the warnings
This commit removes the following warning logs from the `npm publish` output: ``` 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 warn publish "repository.url" was normalized to "git+https://github.com/mozilla/pdfjs-dist.git" ``` For the "scripts" section it turns out that if the package doesn't have any scripts it's expected to explicitly set it to an empty object; refer to npm/cli#6918 and denoland/dnt#414. For the "repository.url" section it turns out that the URL must point to a Git URL that doesn't resolve to an HTML page in the browser; refer to https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository.
This commit removes the following warnings from the `npm publish` output: ``` 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 warn publish "repository.url" was normalized to "git+https://github.com/mozilla/pdfjs-dist.git" ``` For the "scripts" section it turns out that if the package doesn't have any scripts it's expected to explicitly set it to an empty object; refer to npm/cli#6918 and denoland/dnt#414.
This commit removes the following warnings from the `npm publish` output: ``` 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 warn publish "repository.url" was normalized to "git+https://github.com/mozilla/pdfjs-dist.git" ``` For the "scripts" section it turns out that if the package doesn't have any scripts it's expected to explicitly set it to an empty object; refer to npm/cli#6918 and denoland/dnt#414.
Still seeing this problem with Node v20.15.1 (NPM 10.7.0). Not quite sure why this issue was closed when the incorrect behavior still exists (summarized well by @mcqj in #6918 (comment)). |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Npm shows unexpected warning every time, when I am publishong any of my packahes.
Result:
pachage.json
:Expected Behavior
No warnings should be desplayed, because
package.json
has noscripts
ptoperty at all.Steps To Reproduce
See above.
Environment
; copy and paste output from `npm config ls` here
The text was updated successfully, but these errors were encountered: