-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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] npm -g update serverless@pre-3
wipes global node_modules
#4240
Comments
Use install, not update. npm update -g doesn’t make sense as a command because there’s no global package.json to update. |
Thanks for the quick response. I would follow up with 2 separate questions:
|
Yea, installing a package always must install its dependencies also, or it’d never work. Yes, i agree that’s still a problem. |
We are talking about update, not installation. This is when a package is already installed. |
The same remains true. Updating is never anything more than “installing the new version”, in any software I’m aware of, but especially in npm. |
I reproduced it in a Docker container:
In the container, I installed latest Node and NPM (https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04), then ran:
Result: |
This seems to actually be caused by the
☝️ no problem
☝️ wipes everything It seems to be a duplicate of #3175 |
Arborist update does not support anything other than dependency names, that is confusing to some users that are used to provide semver ranges when using `npm install` and other commands. This changeset adds validation to the values provided as arguments in `npm update` and will throw a `EUPDATEARGS` error in case the user tries to use semver ranges, e.g: `npm update [email protected]` Relates to: npm#4240
* feat(arborist): add named updates validation Arborist update does not support anything other than dependency names, that is confusing to some users that are used to provide semver ranges when using `npm install` and other commands. This changeset adds validation to the values provided as arguments in `npm update` and will throw a `EUPDATEARGS` error in case the user tries to use semver ranges, e.g: `npm update [email protected]` Relates to: #4240
Same without the
|
@mryellow what version of npm are you using? This should have been fixed as of |
|
@mryellow try |
All good I can avoid running global updates. Strangely it even removed
|
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Running
npm -g update serverless@pre-3
wipes the content of the global node_modules directory (/usr/local/lib/node_modules
).Here is a log file of the command: https://gist.github.com/mnapoli/0170614e3f4ab1915a82783bf871d033
Here is what I tried to pinpoint the problem:
npm update serverless@pre-3
)npm -g i pure-prompt
worksnpm -g update pure-prompt
worksnpm -g i serverless
worksnpm -g update serverless
worksnpm -g i serverless@pre-3
worksnpm -g update serverless@pre-3
❌ wipes everythingyarn global add serverless
worksyarn global update serverless@pre-3
worksExpected Behavior
Nothing should be removed, the package should be installed.
Steps To Reproduce
Run:
Now all global dependencies are gone (e.g.
serverless
,npm
, etc.). The global folder/usr/local/lib/node_modules
still exists, but it's empty.I have to reinstall NPM and reinstall all global NPM dependencies.
Environment
The text was updated successfully, but these errors were encountered: