Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get last version of NPM working

Tags:

node.js

npm

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;

like image 505
Cereal Killer Avatar asked Oct 19 '14 17:10

Cereal Killer


People also ask

Can not check npm version?

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\; .

Why isn't my npm start is not working?

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.

How do I get the latest version of npm?

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.


2 Answers

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
like image 158
baaroz Avatar answered Sep 24 '22 07:09

baaroz


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.

like image 36
Wil Moore III Avatar answered Sep 20 '22 07:09

Wil Moore III