I'm trying to update npm to latest version, since I'm using the 1.4.28. Using:
npm update -g npm
I get the following output:
[email protected] C:\Users\ck\AppData\Roaming\npm\node_modules\npm-check-updates\node_modules\npm
[email protected] C:\Users\ck\AppData\Roaming\npm\node_modules\ember-cli\node_modules\npm
and then running
npm -v
I can see that I'm still using the 1.4.28; I can't understand the output I got after trying to update, since it is talking about 1.3.26 and 2.1.5, but I have installed 1.4.28??
I'm on windows and I've already tried to uninstall and reinstall node;
On Windows, you may need to check both your user path and system path. If C:\Program Files\nodejs\; appears in system path and C:\Users\<username>\AppData\Roaming\npm , then npm will refer to the version in C:\Program Files\nodejs\; .
Check if you have a package. json file in your project. Check if you have a start script in the json file. Check if the ignore-script config is set to true.
Make sure to use sudo npm install -g npm if on a Mac. You can also update all outdated local packages by doing npm update without any arguments, or global packages by doing npm update -g . To update Node. js itself, I recommend you use nvm, the Node Version Manager.
from this page:https://github.com/npm/npm/wiki/Troubleshooting
on windows:
Option 1:
edit your Windows installation's PATH to put C:\Users\<username>\AppDa\Roaming\npm before
C:\Program Files (x86)\nodejs. Remember that you'll need to restart cmd.exe (and potentially restart Windows) when you make changes to PATH or how npm is installed.
Option 2: remove both of before updating
C:\Program Files (x86)\nodejs\npm
C:\Program Files (x86)\nodejs\npm.cmd
Option 3: navigate to C:\Program Files (x86)\nodejs
with cmd.exe and then run the installation without -g:
npm install npm
on linux:
npm install -g npm@latest
In order to install the latest npm, you'll run:
npm install -g npm@latest
You'll also need to ensure that if you have multiple npm
commands installed, you are using the latest (rather than the original npm
installed with node
).
Try this:
which -a npm
Based on your findings from the above command, you may need to adjust your PATH
environment variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With