I'm using nvm-windows version 1.1.7.
I just installed node 11.9.0.
nvm installs npm version 6.5.0 together with this node version.
However, there's npm version 6.7.0 available already.
When I now do npm i -g npm I get:
npm ERR! path C:\Program Files\nodejs\npm.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npm.cmd
npm ERR! Move it away, and try again.
I found no way to avoid this.
This is a duplicate from my answer here: https://stackoverflow.com/a/50955293/491553
Here is how I upgrade npm when running nvm-windows:
cd %APPDATA%\nvm\v14.20.0 # or whatever node version you're using
move npm npm-old
move npm.cmd npm-old.cmd
move npx npx-old
move npx.cmd npx-old.cmd
cd node_modules\
move npm npm-old
cd npm-old\bin
node npm-cli.js i -g npm#latest --force
And boom, upgraded.
Several workarounds are available in this Issue on the nvm-windows github repo:
https://github.com/coreybutler/nvm-windows/issues/300
There are examples using DOS, PowerShell, bash, and batch scripts.
I have windows 10 operating system.
I installed in following way.
cd %APPDATA%\nvm\v8.11.3
move npm 5.6.0
move npm.cmd 5.6.0.cmd
cd node_modules\
move npm 5.6.0
cd 5.6.0\bin
node npm-cli.js i -g npm#latest
I had to force it :-/
When it came to
node npm-cli.js i -g npm#latest
I'd rather had to use
node npm-cli.js i -g npm#latest --force
probably to overcome a permission error involved in overwriting the "C:\Program Files\nodejs" link.
download this updateNpm.bat file
open powershell in that same folder and run this command updateNpm.bat latest
I tried the script and other solutions, this by far is the easiest way:
Navigate to the relevant Node folder (cd C:\Users\yourUser\AppData\Roaming\nvm\vxx.xx.x)
rename npm -> npm2
rename npm.cmd -> npm2.cmd
rename npx -> npx2
rename npx.cmd -> npx2.cmd
Run npm2 install -g npm#your-version
the new npm will create npm, npm.cmd, npx, npx.cmd files, so you can remove the previous renamed files
I also found it necessary to install windows-nvm to c:\nvm and c:\nodejs to prevent issues with unsupported paths with spaces.
rm C:\nodejs\npm*
rm C:\nodejs\npx*
mv C:\nodejs\node_modules\npm C:\nodejs\node_modules\npm-old
node C:\nodejs\node_modules\npm-old\bin\npm-cli.js i -g npm#next
For me I only get the problem when updating npm with npm v6.
So using a newer version of npm via npx to run the upgrade works for me.
For the very newest version
npx npm install -g npm
Or use a specific version
npx npm#7 install -g npm#7
I faced this problem today, the way i solved it was installing latest node with nvm then copying the npm files from latest to the version i am on.
nvm install latest
cd AppData/Roaming/nvm/LATEST
xcopy npm.cmd ../LTS && xcopy npm ../LTS && xcopy node_modules/npm ../LTS
I then confirmed it working by trying to compile my code that breaks on latest.
This worked for me:
curl -L https://npmjs.org/install.sh | sh
If you already have git bash installed, use it there.
Related
I'm trying to to upgrade npm packages via
npm update -g
But, I get this error:
npm ERR! path C:\Program Files\nodejs\npm
npm ERR! code EEXIST
npm ERR! Refusing to delete C:\Program Files\nodejs\npm: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npm
npm ERR! Move it away, and try again.
I've googled but none of the solutions work. One sadi to remove the npm.cmd and npm files from here:
C:\Program Files\nodejs\
I tried that, but it fails as npm is now missing.
That folder, C:\Program Files\nodejs\, is actually a shortcut pointing to
C:\Users\lthurman\AppData\Roaming\nvm\v8.11.1
I'm using nvm to manage my node installations, any ideas on how to fix this?
Thanks
To resolve this issue I took the following steps
Where [userName] is your Windows user name -- [nodeVer] is your current version of Node, or the one that is giving you issues using NVM
Delete these four files:
C:\Users\[userName]\AppData\Roaming\nvm\[nodeVer]\npm
C:\Users\[userName]\AppData\Roaming\nvm\[nodeVer]\npm.cmd
C:\Users\[userName]\AppData\Roaming\nvm\[nodeVer]\npx
C:\Users\[userName]\AppData\Roaming\nvm\[nodeVer]\npx.cmd
Then in C:\Users\[userName]\AppData\Roaming\nvm\[nodeVer]\node_modules\, rename the npm directory to npm_old
Open up your console of choice -- run as admin if necessary -- and navigate into the \npm_old\bin directory then install NPM at latest (or replace latest w/a version of your choosing) using the command below:
node npm-cli.js i -g npm#latest
Clean-up by deleting the npm_old directory from earlier. Now all should be good to go...I hope!
Try doing this below command after deleting the folder C:\Users\xxx\AppData\Roaming\npm, C:\Users\xxx\AppData\Roaming\npm-cache.
npm install -g npm#latest
It will fixed it by forcing the install with --force
npm install -g npm#latest --force
Uninstall old version first
npm uninstall -g your-package-name
install the latest
npm install -g your-package-name#latest
I'm getting into trouble with anngular-cli installation because it doesn't recognize the ng command in my git bash but it works in my cmd on Windows 7.
I looked for some issues on the web but I didn't really find a solution.
Here, the error :
ng -v
module.js:549
throw err;
^
Error: Cannot find module 'C:\Program
Files\Git\node_modules\#angular\cli\bin\ng'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
This error happened the first time I used ng after installing Node and angular-cli globally.
I didn't get this error when I was working on my laptop on Windows 10.
Problem:
Error: Cannot find module
'..\AppData\Roaming\npm\node_modules\angular-cli\bin\ng' angularJs
Solution:
uninstall angular cli if you have already installed it
npm uninstall -g #angular/cli
Delete the C:\Users\Satish\AppData\Roaming\npm\node_modules#angular folder if it still exists after the uninstall
reinstall angular-cli globally
npm install -g #angular/cli
First, uninstall the angular cli using
npm uninstall -g #angular/cli
Then delete the "NPM" and "Npm-cache" folder under "Roaming" folder.
Now again install the Angular cli using
npm install -g #angular/cli
It worked for me only by removing npm and npm-cache folders from AppData then running :
npm uninstall -g #angular/cli
Then running :
npm install -g #angular/cli
In my case, i fixed it simply just by renaming my project folder.
before : "d/Gdrive/Sem 6 & 7/[project name]"
after : "d/Gdrive/Sem 67/[project name]"
So i guess u may not put special characters in your folder name.
Looks like a dependency was removed somewhere. I worked around this by:
For local angular-cli: npm install #angular-devkit/core --save-dev
For global angular-cli: npm install -g #angular-devkit/core
Edit: As discussed below, you should perhaps not use --save-dev here.
Remove existing angular
npm uninstall -g #angular/cli
and Install
npm install -g #angular/cli --force
reinstall node_modules
git clean -dfx
npm i
if persist, use yarn install first, then repeat above
The git bash is installed in C:\Program Files\Git where you never find the node_module folder that's why this error occurred
When you hit ng command from CMD it will look node_module folder in C:\Users\uername\AppData\Roaming\npm\ - where npm install global dependency and eventually it finds node_modules folder.
Basically for windows try to run from cmd.
In my case the problem is
npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\node_modules\#angular\cli\bin\ng.js
npm ERR! dest C:\Program Files\nodejs\ng
npm ERR! EEXIST: file already exists, cmd shim 'C:\Program Files\nodejs\node_modules\#angular\cli\bin\ng.js' -> 'C:\Program Files\nodejs\ng'
npm ERR! File exists: C:\Program Files\nodejs\ng
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\<UserId>\AppData\Roaming\npm-cache\_logs\2022-01-03T20_13_43_709Z-debug.log
Solution:
I use this comment of npm 5 line on the shell
$ npm ERR! File exists: C:\Program Files\nodejs\ng
Delete the file ng and run:
npm install -g #angular/cli
And Done!
I faced the same problem but running npm install solved my problem.
I had this error in Angular Console starting with release 11.
I was missing a locale cli. So
npm install #angular/cli
solved my problem
It might be an issue with the package installation. Sometimes the installation might brake due to network issues. Also the access permission affects the installation.
So, try to install the package by running command prompt (CMD) as Run as administrator.
Follow the steps to resolve the issue.
1.Run CMD as Run as administrator mode.
2.Uninstall angular cli.
npm uninstall -g #angular/cli
3.Remove npm package files from the appdata folder.
Open Run option by pressing Windows + R key. Then type %appdata% and press OK.
Open the npm folder from the Roaming folder that you got in the explorer.
Delete ng and ng.cmd files from the npm folder if exists.
Open node_modules folder from there and delete #angular and angular/cli folder if exists.
4.Reinstall the angular cli
npm install -g #angular/cli
npm install --legacy-peer-deps
npm cache clean --force
If the environment variable path is properly set , please run ng in an angular project otherwise it will keep showing that error
once you run npm uninstall -g #angular/cli, check if there is an error in the console, it is usually a message with red line says "err!", mine said that it was unable to delete a file , follow the path of the file and delete manually ,then run npm uninstall -g #angular/cli and npm uninstall #angular/cli, when it goes successfully , run npm install -g #angular/cli , that should fix it.
If most suggested and obvious solution below do not work
npm uninstall -g #angular/cli
remove roaming -> npm
npm install -g #angular/cli
Try to upgrade Node.js version. This solved the problem in my case after severl hours of investigation
Try deleting the node_modules folder (not the AppData one), the one in your project folder, and try reinstalling angular again.
If you have MAC(Mackbook) pc use brew command because we can not install angular-cli from npm command
brew install angular-cli
I just installed node v9.11.1 when I try to use npm I keep getting the following error:
npm WARN npm npm does not support Node.js v9.11.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
I tried to do npm i -g npm but it couldn't update itself, it just kept throwing the same error above.
When I run npm -v it says 5.5.1 it seems the latest version is currently 5.8.0.
I tried deleting the folder and running the repair function on the node.js installer, but it didn't replace the module.
Delete the Global NPM Folder
https://stackoverflow.com/a/5926706/349659
npm list -g
For Windows this will most likely be:
%AppData%\npm\node_modules
You can paste that into a folder's address bar and it will take you there.
Once there delete the folder named npm.
Download the Latest Release of NPM
https://github.com/npm/cli/releases/latest
Grab the zip and unzip it to your node_modules folder that you just deleted the npm folder from.
Rename the folder you extracted from the zip to npm
If you get any warnings about the file path or name being too long skip the warnings.
Update for Good Luck
Now you should be able to run npm i -g npm to update/reinstall npm without any warnings.
I find this step especially important if you had errors in Windows about the path or file name being too long.
You may get the following errors. If you do go and delete or move the files it has listed and you should be able to run npm i -g npm successfully.
npm ERR! Refusing to delete C:\Program Files\nodejs\npx.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npx.cmd
npm ERR! Move it away, and try again.
npm ERR! Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npm.cmd
npm ERR! Move it away, and try again.
Somehow I had a broken installation of npm so reinstalling it with itself (e.g. npm install -g npm or similar) would not work.
The npm readme actually defines a very simple way to install npm again using this curl command:
curl -qL https://www.npmjs.com/install.sh | sudo sh
This installation script actually removes any existing npm installations, then installs the latest version for you.
Try this:
npm install npm#latest -g
More info here.
Try this command to reinstall npm
npm install -g npm-reinstall
If you are using a linux distribution add sudo
sudo npm install -g npm-reinstall
Since I am all about one-liners, let me make this very damn easy for you.
Open your GitBash or Cygwin(I think both GitBash and Cygwin stores the Windows pre-defined Environment Variables and paths in their storage, so this becomes way easy), on any path, and run this one-liner from there:
rm -rf $APPDATA/npm; npm install -g npm#latest; npm list -g;
rm -rf $APPDATA/npm; - this will purge the old global npm folder completely.
npm install -g npm#latest; - this will install the latest version of NPM available(so no need to install minor versions after this ;)).
npm list -g; - this will show you details of your NPM global profile.
If anyone insists on doing this in PowerShell then here's the way:
$env:Path += ";C:\Program Files\nodejs\"
cmd /c 'del /s /q /f %APPDATA%\npm && rd /s /q %APPDATA%\npm'; npm install -g npm#latest; npm list -g;
$env:Path += ";C:\Program Files\nodejs\" - Ensures that Nodejs is added to Path for atleast running PowerShell session. (Caution: Run this only once, as long as no errors.).
cmd /c 'del /s /q /f %APPDATA%\npm && rd /s /q %APPDATA%\npm'; - Ensures that the necessary step of fully purging the %APPDATA%\npm folder is done with measure.
For me even deleting npm folder or reinstalling Node didn't help. After updating Nodejs and npm to latest version (Node 10.19, npm 6.14.3) of my CentOS 6, I've got constant libs error with npm while Node was fine.
What's worked - n Node version manager. With this command I could reverse my npm version: n -p 6.13 link
I updated to the latest node v9.1.0 and now npm doesn't work.
npm WARN npm npm does not support Node.js v9.1.0
It turns out that the current installed npm is not compatible with the new node and has a hard time updating.
The solution is to uninstall npm and then reinstall node which will contain the correct version of npm.
Here's how:
Uninstall npm.
Mac:
sudo npm uninstall -g npm
Windows:
npm uninstall -g npm
Install node from https://nodejs.org
Uninstall the global instance of npm:
npm uninstall -g npm
This will cause your system to fall back on the version of npm installed by node 9.1.0 and the warning will disappear.
What worked for me was to delete npm and npm cache from C:\Users\chrisd\AppData\Roaming
Then I ran npm i -g npm#next for the latest version of npm for Node 9.x
NPMJS.org has issued a new release 11.27.2017 -- npm v5.6.0
(You may not have to delete the npm/npm cacheif you just upgrade, but I had already done that before finding the new release)
NPMJS Release notes
Fixed my issue update to 5.71
npm uninstall -g npm
npm i -g npm#next
Had similar issue in linux/ubuntu, below helped solving it.
Remove existing versions of npm and node:
sudo apt --auto-remove purge npm
sudo apt --auto-remove purge nodejs
Re-install node
for me worked
npm uninstall -g npm
npm i -g npm#next
No need for manual installation or clearing the cache.
Run with admin credentials if needed.
I saw this warning after I upgraded to Node 10.4.1 after that I just ran npm uninstall -g npm with -g flag to remove it globally and the error was gone. I guess it updated my npm to version 6.1.0
Solution :
Go to the path where you can find the debug log (this file is found in your npm-cache folder) C:\Users\yourname\AppData\Roaming
Delete the NPM and NPM-Cache folder, but DO NOT reinstall node. Once deleted go back to your command line and re-use the command " npm install -g npm#latest "
What worked for me - On Ubuntu
Install nodejs
sudo apt install nodejs
Install npm
curl -L https://www.npmjs.com/install.sh | sudo sh
If you are unable to uninstall npm, instead you can skip that step and just
Reinstall npm https://nodejs.org/en/
This error occurs when the npm version not compatible with the node version. However npm uninstall -g npm also gives the same error for me.
So following steps work for me.
Option 1:
Step1: Follow this directory
C:\Users(your username)\AppData\Roaming
Step2: Delete the npm folder. And if there is a folder called `npm cache, delete it also.
Step3: Run npm clean cache —force ( — force is now required to clean cache)
If the above option is not worked for you please follow the below steps.
Option 2:
Follow this directory
C:\Users(your username)\AppData\Roaming
Delete the npm folder and if there is one mom cache folder.
Run npm clean cache --force ( -- force is now required to clean cache)
Make sure everything to do with Nodejs is deleted and uninstalled.
Reinstall Nodejs.
I had the same issue with npm when I have updated Node js on windows. I tried many things but only working solution was :
First uninstall npm with below command
npm uninstall -g npm
Now Install latest version
npm install npm#latest -g
If you are using Mac and brew, that's how I've got rid of this problem:
Even though I installed and reinstalled node with brew, with last version 11.8.0, apparently it kept using the last version
fdecollibus$ npm install --global gatsby-cli
npm WARN npm npm does not support Node.js v11.8.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
/usr/local/Cellar/node/11.8.0/bin/gatsby -> /usr/local/Cellar/node/11.8.0/lib/node_modules/gatsby-cli/lib/index.js
+ gatsby-cli#2.4.8
npm -v gave me back version 5.6.0. I've therefore noticed that /usr/local/lib/node_modules had wrong permissions assigned to root:wheel.
A chown did not fix the problem: I've had to manually delete the content of the folder (cd /usr/local/lib/node_modules and -careful - type rm -rf * ) to get rid of the folder.
Then I've run brew uninstall node and again brew install node, and finally npm -v gave me back 6.5.0
Executing npm uninstall -g npm gave me same error
Uninstall Node.js installed in the system
Goto c:\Program File\nodejs (default location of the nodejs installation). Remove all contents of the folder manually.
Remove npm, npm-cache folder from Roaming folder under your username.
Install Node.js again.
running npm install #angular/cli -g worked for me.
I was getting the below warning when I executed, npm install to install package.json for my angular project.
npm WARN npm npm does not support Node.js v9.1.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of Node.js.ng-080b84bf08dd68e5.lock for ...\Angular\node
Please use either the version of npm that is bundled with Node.js, or a version of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) that is compatible with Node.js 9 and above.
C:\Program Files\nodejs\node.exe: src\node_zlib.cc:437: Assertion `args.Length() == 7 && "init(windowBits, level, memLevel, strategy, writeResult, writeCallback," " dictionary)"' failed.
According to #Ilyich, I uninstalled global npm, npm uninstall -g npm
And then I executed npm install to install my package, it installed successfully.
Navigate to the Appdata by typing %AppData% in the run or search.
Delete the npm and npm-cache folder and then install the nodejs again. It solved the issue for me.
If you are getting the same warnings while creating or importing an Angular project in an IDE such as Eclipse ,do the following:
File->New->Angular
In the window that appears change the versions of Nodejs and NPM to "use system installation"
...
If the process crashes at "installing packages for tooling via npm"
Close the terminal in IDE and manually go to the project directory and do "npm install".
Refresh the project in IDE
I had a similar issue trying to install other stuffs.
And looks like the npm version was not compatible with my node version.
In my case i had npm 5.4.2 and node v10.15.0
At the end of this process i had the version npm 6.7.0 and node v10.5.0
First Option:
I downgrade the version of node and other tools.
On terminal execute the next command with the version to be installed. (Example if we need change to node 8.14.1)
1.- Npm install -g node#8.14.1
Then we execute the command to uninstall the version to be removed.
2.- Npm uninstall -g node#8.15.0
After that we need execute the next command to set the new path
3.- Npm update -g node#8.14.1
Finally we only need execute the version to see if the changes were added successfully
4.- Node -v
In this case we will see the version as 8.14.1 and we finished the process.
If you want do it for Appium and Npm version you can open a new terminal and follow the same steps in order to change the version. For example:
Npm install -g appium#1.7.2
Npm uninstall -g appium#1.10.0
Npm update -g appium#1.7.2
Appium -v
In my case you must have the next versions:
Node 8.14.1
Npm 6.4.1
Other Way:
To solve it i just execute in the terminal the next line.
curl -L https://npmjs.org/install.sh | sh
After download a few files (took around of 10 minutes to see results in the terminal) i was able to continue working with the new latest and compatible version of both tools.
The next WARM was displayed in this case.
npm WARN npm npm does not support Node.js v10.15.0.
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
/Users
I am on a macOS and what ended up working for me was uninstalling npm, relinking Node, and reinstalling Node through Homebrew. (Prereqs: Have Homebrew installed and have a very confusing setup where npm and Node don't work together)
1. To uninstall homebrew:
If you are on a Mac, you probably don't see the AppData\Roamingfolder; you should instead go to npm root -g and delete the npm_modules folder. Now, when you type npm --version your computer should be confused.
2. Reinstalling node:
Try doing brew install node and if you already have node installed, your computer will ask you to reinstall it. If you do brew reinstall node and your versions of brew and npm look good, then you don't need to do the last step!
3. If you need to link the correct version of Node:
This step was something I think was my fault since I think I had installed Node through Homebrew as well as the actual online download. Follow the suggestions after brew link node which should take you to brew link --overwrite node. There will be around 7 directories that the command will not be able to overwrite, which you should all delete using sudo rm -rf directory_name. (Do use your common sense, don't delete something important.) After you are finally able to run the brew link --overwrite node command without any errors, you should then do brew reinstall node since you don't have npm anymore.
Tada! You hopefully now have version of npm and node that hopefully can work together.
Just install latest version of Node.js from https://nodejs.org
This will automatically update npm for you
Easiest way I found was to install the latest node with brew and the latest npm manually:
brew uninstall node
brew install node
npm install -g npm#latest
This removed the warning message. For some reason brew wasn't linking the new npm installed by node while it was updating node itself.
The easiest way(for windows) is to use the installer to remove node, then use it to reinstall node, at which time it will install the correct version of npm. running the above uninstall commands does not work, since the wrong version of node is installed, otherwise you wouldn't have this issue.
You can uninstall node current version, and install a early version that support npm. Then run npm install npm#latest -g and install current node version.
It's work for me
lowering the npm version worked for me (windows 10):
npm i npm#6.14.11
To upgrade the npm and Node:
Step 1. Uninstall the npm:
Mac: `sudo npm uninstall -g npm`
Windows: `npm uninstall -g npm`
Step 2: Install the latest version of Node: https://nodejs.org/en/
I want to install the latest stable version of node - Version 0.6.19 (stable).
http://blog.nodejs.org/ indicates to upgrade to NPM to 1.1.24
Is there a simple way to upgrade to this? I can't figure out how exactly to download and target this version.
The below gives me npm -v 1.0.106
npm upgrade npm
or
npm upgrade npm 1.1.24
Update 2 (03/11/15)
Courtesy: whyleee
On Windows npm is installed together with node in "Program Files". Use npm install npm -g to install it in "%AppData%\npm" and delete 'npm', 'npm.cmd' files from "C:\Program Files\nodejs" dir (because your PATH is looking there first). After that you can use npm update npm -g in the future
According to the docs
For windows (it also worked on Mac for me)
To update npm, run the npm update npm -g command.
Also verify this
Hope this helps
The only thing that worked for me was (from npm readme)
Fancy Windows Install
You can download a zip file from https://npmjs.org/dist/, and unpack
it in the same folder where node.exe lives.
In my case folder is :
C:\Program Files (x86)\nodejs
Edit: It seams that newer versions of npm does not exist on address I wrote. I will copy paste instructions from npm git page
You can download a zip file from https://npmjs.org/dist/, and unpack
it in the same folder where node.exe lives.
The latest version in a zip file is 1.4.12. To upgrade to npm 2,
follow the Windows upgrade instructions in the npm Troubleshooting
Guide:
https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows
If that's not fancy enough for you, then you can fetch the code with
git, and mess with it directly.
In ubuntu you can upgrade it using
sudo npm update npm -g
In windows, to install latest version of npm
npm install npm#latest -g
&
In ubuntu you can use
sudo npm install npm#latest -g
*note: the latest version till sept 12 2016 is
(The current stable version of npm is) 3.10.7
check version by running on command prompt
npm -v
https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows
Option 3: navigate to C:\Program Files (x86)\nodejs with cmd.exe and then run the installation without -g:
This sovled it for me.