-
-
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
A way to update npm ? #13
Comments
Just run |
Heya, I just wanted to add that upgrading updating npm isn't quite as simple as just
(I used Here is a list of the things you need to do when not using NVM on the official npm wiki: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows. But there's actually an easier way if you're using NVM. Since NVM links both binaries and folders, you can just go and update the original global node modules manually. This doesn't require neither admin permissions nor moving files around. First run
The |
I just spent hours trying to pinpoint the cause of this error before coming across this comment. Maybe this workaround should be displayed more clearly or this issue reopened as I'm sure trying to update npm with the standard command is quite a common operation and currently it fails and gives the very esoteric error message shown above. |
I think this is more of a previous npm version bug than nvm one. However, to update npm delete in
Rename npm folder to npm2
Open any console with admin rights (or even right mouse click on vscode shortcut, than right mouse click on Visual Studio Code and hit Run as administrator) and type commands:
Done. Delete |
The only solution that worked for me. |
It worked for me, too. Thanks! :) |
Awesome help @createdbyjurand cheers |
Thank you, @createdbyjurand ! I have been pulling my hair out trying to figure out why the regular commands were not working. This is fantastic! 💯 |
Thanks to @createdbyjurand ! I needed to update in |
Thank you so very much to @createdbyjurand. This worked flawlessly! I wrote a script for it for PowerShell, if anyone wants it; you can run it form anywhere as long as you update the node version being updated (substitute both instances of Username and Version of Node with your own):
Run with the usual |
The solution outlined by @createdbyjurand does work but has to be repeated every time you install a new version of node. It also causes the following error message updating npm after the initial workaround:
I don't understand the inner workings enough to know if this is a bug with nvm, npm or scoop but, as it seems to be nvm, I think this issue should be reopened @coreybutler as updating npm is quite a fundamental operation which is currently completely broken with this set-up. |
I just updated with
|
@raikesy - npm and nvm have no operational relationship... meaning nvm just leaves npm alone. It merely downloads the npm archive and extracts it to the appropriate installation folder. That's it. NVM4W doesn't touch the executable files. Unlike nvm for *nix, there is no shim. When Tools like scoop, homebrew, chocolatey, etc may or may not modify behavior. I don't really know because I don't maintain those. However; I don't think any of those are the problem because I can replicate these problems with standard Node installs (i.e. no nvm4w, no package manager, just a straight up msi install from nodejs.org). @createdbyjurand is correct that this behavior often comes from older versions of npm. npm has gone through a number of rather difficult design decisions, especially with versions shipping in the Node 8.x.x line where there were some hard-coded path files used for installation. |
@coreybutler this might be more headache than it is worth, but as you say
Couldn't we then say that NVM's responsibility starts (and ends) at the installation of NPM? If so I feel like my concerns can be addressed by having something like You mentioned that you also verified an issue exists in the official node release MSI install. Can you clarify what issue you verified? Was it with an older MSI installation that shipped with an older NPM? I'm running a clean system that hasn't had any node or npm installed prior to NVM and I'm running into these issues. |
@createdbyjurand I updated your script so that you don't have to edit the script to run it, even when switching versions of node. I also took out @next because that installs a pre-release (non-stable).
|
I am using Windows 10 and I spent a whole day on updating pm. Nothing worked but following. https://www.wdiaz.org/update-npm-when-node-was-installed-using-chocolatey-on-windows/ Steps 1: Copy and Paste the following lines into a file somewhere in your directories and give it the .cmd extension. You should be good to go now with the most up to date version of node. |
Windows 10, PowerShell: PS> nvm list
PS> cd "$env:APPDATA\nvm\v99.99.9"
PS> npm install npm --no-save (Change digits to the node version where you want to update npm.) |
No description provided.
The text was updated successfully, but these errors were encountered: