Updating NPM with Nodist - node.js

I'm unable to update npm, and get it to use with Nodist.
Whenever I try to update npm with the command
npm install -g npm
the following message comes right after executing it:
(node:5304) fs: re-evaluating native module sources is not supported.
If you are using the graceful-fs module, please update it to a more recent version.
C:\Program Files (x86)\Nodist\v\nodev6.5.0\npm -> C:\Program Files (x86)\Nodist\v\nodev6.5.0\node_modules\npm\bin\npm-cli.js
npm#3.10.6 C:\Program Files (x86)\Nodist\v\nodev6.5.0\node_modules\npm
Doing an npm -v right after, gives me the previous version:
...> npm -v
2.14.10
However, if you noticed the last line in the message above, there is npm#3.10.6 which means it is somehow trying to install that version of npm.
I also followed instructions from this post for Ubuntu users and this for Windows users, but they seem to address issues with standalone NodeJS installations and NOT NodeJS + Nodist combo.
Meanwhile, I was wondering if Nodist itself enables us to update npm, or in other words, does it have any version management feature for npm as well, just as it does for node.
Thanks for any help in advance.
Additional Info
I am using Nodist v0.7.1 on Windows 7.

You can try nodist npm latest
Nodist manages npm versions as well as node versions.

Turns out that Nodist versions prior to v0.7.2 have an issue with getting npm set with Nodist correctly (refer the Nodist changelog).
Performing an npm install -g npm was in fact installing the latest version of npm under the v-x64 in Nodist's root installation folder - which is not where Nodist itself looks for npm installation.
Nodist looks for npm inside the \bin folder:
Solution
Add the bin folder's path to your PATH.
cd to the Nodist installation > bin directory with your terminal,
and then perform:
npm install npm
(not with -g flag of course).
Alternatively, if npm install doesn't work in this step, copy an already installed npm and paste it in the node_modules folder within the bin directory.
As a side note, remember to remove some values from your PATH which I suppose may cause conflicts with global package installations (i.e. with -g flag) with npm, before installing Nodist, which are as follows:
%appdata%\npm; OR C:\Users\username\AppData\Roaming\npm;
%ProgramFiles%\nodejs;

I used to have the same issue.
You should use the following command nodist npm 6.14.5, changing the version you need.
And you can see more option whith this command: nodist --help is where I found the answer:
see an example

Related

npm does not support Node.js v12.18.3

Can see it's been asked a dozen times but none of the solutions I've found have worked for me so far.
I've installed the latest version of Node.js (12.18.3) on my Windows 10 PC and I'm trying to install a package using npm. When I input npm -v it comes back with 5.6.0, which to me looks out of date - but when I try and install a package or update npm, I get the following error every time:
npm WARN npm npm does not support Node.js v12.18.3
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/
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
I've tried uninstalling Node.js completely, deleting all node_modules folders and restarting my computer after a fresh install, but it's the same thing each time. I've also tried using npm install -g npm and npm install npm#latest -g but again, I get the same error.
Any solutions here?
I found the work-around !
First you need to open your cmd line, and use " npm install -g npm#latest "
you'll get the error like this
C:\Users\KimeruLenovo>npm install -g npm#latest
npm WARN npm npm does not support Node.js v14.7.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/
npm ERR! cb.apply is not a function npm ERR! A complete log of this
run can be found in: npm ERR!
C:\Users\KimeruLenovo\AppData\Roaming\npm-cache\_logs\2020-08 10T09_36_56_388Z-debug.log
Go to the path where you can find the debug log( this file is found in your npm-cache folder)
C:\Users\KimeruLenovo\AppData\Roaming
Delete the NPM and NPM-Cache folder, but DO NOT reinstall node .
once deleted go back to your comand line and re-use the command
" npm install -g npm#latest "
This should do the trick :)
I also had the same issue, Windows 10 with npm v6.4.1 and trying to upgrade node from v9 to v12.18.3.
The problem seemed to be that whenever I tried to install the latest version of node, npm wasn't upgraded and npm v6.4.1 only supported node up until v11 (even though the download page says "Latest LTS Version: 12.18.3 (includes npm 6.14.6)": https://nodejs.org/en/download/).
This Github issue led me to the solution, which was to uninstall node (Settings -> Add or remove programs), then navigate to C:\Users\{User}\AppData\Roaming and delete the npm and npm-chache folder and finally install node again (using the installer).
The problem on my end was arising because I was using NVM yet I had already previously installed NPM independently.
All I did to solve the issue was delete the npm and npm-cache folder located here:
C:\Users\your-username\AppData\Roaming. No need of doing a fresh npm install (just leave that to NVM)
I had the same problem. Delete node and npm cache in AppData folder inside C: drive and install recommended version on another drive.
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 "
I had same issue.
I tried to install node with choco install -y nodejs.install.
then, npm i works fine.
(before that, nodist was uninstalled)
I used nodist to install node. it may be the cause I think.
I have the same problem even after reinstalling Visual Studio. Cleared caching, and the weird thing, the Node.Js which is installed is the lastest (12.18.3)
So far i've found the node modules of the npm package, in the troubleshooting file they were accuring this solution
"
You can check your npm version by running npm -v.
Steps to Fix
Upgrading on *nix (OSX, Linux, etc.)
(You may need to prefix these commands with sudo, especially on Linux, or OS X if you installed Node using its default installer.)
You can upgrade to the latest version of npm using:
npm install -g npm#latest
Or upgrade to the most recent LTS release:
npm install -g npm#lts
Upgrading on Windows
We have a detailed guide for upgrading on windows on our wiki.
Proxy and Networking Issues
npm might not be able to connect to the registry for various reasons. Perhaps your machine is behind a firewall that needs to be opened, or you require a corporate proxy to access the npm registry. This issue can manifest in a wide number of different ways. Usually, strange network errors are an instance of this specific problem.
Sometimes, users may have install failures due to Git/Github access issues. Git/GitHub access is separate from npm registry access. For users in some locations (India in particular), problems installing packages may be due to connectivity problems reaching GitHub and not the npm registry.
If you believe your network is configured and working correctly, and you're still having problems installing, please let the registry team know you're having trouble.
Steps to Fix
Make sure you have a working internet connection. Can you reach https://registry.npmjs.org? Can you reach other sites? If other sites are unreachable, this is not a problem with npm.
Check http://status.npmjs.org/ for any potential current service outages.
If your company has a process for domain whitelisting for developers, make sure https://registry.npmjs.org is a whitelisted domain.
If you're in China, consider using https://npm.taobao.org/ as a registry, which sits behind the Firewall.
On Windows, npm does not access proxies configured at the system level, so you need to configure them manually in order for npm to access them. Make sure you have added the appropriate proxy configuration to .npmrc.
If you already have a proxy configured, it might be configured incorrectly or use the wrong credentials. Verify your credentials, test the specific credentials with a separate application.
The proxy itself, on the server, might also have a configuration error. In this case, you'll need to work with your system administrator to verify that the proxy, and HTTPS, are configured correctly. You may test it by running regular HTTPS requests.
"
I'll try to work on it and keep you informed if i'm able to solve this problem
Go to the path where you can find the debug log( this file is found in your npm-cache folder) C:\Users\KimeruLenovo\AppData\Roaming
Delete the NPM and NPM-Cache folder, but DO NOT reinstall node . once deleted go back to your comand line and re-use the command " npm install -g npm#latest "
This should do the trick :)
As mentioned earlier, is that I deleted these folders before installing the new version and also worked.
Start by uninstalling the node js by running npm uninstall -g npm, you will fall back to the previous version of Node.js
Just install what is required from the official site of Node.js https://nodejs.org/en/
No SO version or command lines required
If none of these solutions work which happened to me just go to https://nodejs.org/en/ and download the recommended version manually super fast!
Use n.
I am so glad discovered this package.
if npm installed;
npm install -g n
n lts
for other ways or more details;
https://www.npmjs.com/package/n
My specific case required that I use node 12.14 and I was getting this error.I tried installing the npm version but still was getting this issue
I was using NVM, so I uninstalled all other versions of node using
nvm uninstall 18 And like this all other versions
Before uninstalling the last version, I was getting some error so I ran
nvm deactivate
After which I uninstalled the last remaining node version too
I uninstalled the npm after that, and installed just the node version I needed using NVM
nvm install 12.14
and it installed the required npm too, with it my problem was solved. Hope this would be of use to someone

npm 5.8.0 does not support Node.js v10.15.2 on Ubuntu 19.04

I am trying to build an application using Node.js integrated into Visual Studio Code. The most important versions of the software I have are:
The version of Node.js I have is v10.15.2.
The version I have for npm is 5.8.0.
I have Ubuntu 19.04 as OS.
It seems that there is a compatibility issue with the old npm.
So I tried to do the following operations to correctly install the last version of npm:
1) npm uninstall -g npm
2) sudo npm cache clean -f
3) sudo npm install -g npm
4) npm -v but it still gives 5.8.0.
I followed the procedure described here but it doesn't seem to be working.
In addition I found this useful additional post but nothing happened.
If useful I am also posting the output of the debugger in the print-screen below:
Lastly after those steps I receive the following confirmation:
But as soon as I try to check the version npm -v it still gives 5.8.0
EDITS
The following is the output after a couple of additional trials:
Thank you for pointing in the right direction to solve this matter.
The default version of npm for Node 10.15.2 is 6.4.1. Depending on how you installed, the ordering of directories in your PATH environment variable will make a difference. To view all npms on your PATH, run:
which -a npm
Another helpful command is to list out your globally installed packages including where they're installed:
npm ls -g --depth=0

Global Node Packages Installed to Wrong Directory

I'm trying to install Hexo globally using npm. When I run
npm install -g hexo-cli
I'm informed that it was installed to /Users/myusername/.node/bin/hexo -> /Users/myusername/.node/lib/node_modules/hexo-cli/bin/hexo
The problem comes in when I run hexo init blog and the hexo command is not found.
I installed Node and npm with Homebrew, so when I run which node and which npm, the results are /usr/local/bin/node and /usr/local/bin/npm respectively.
I'm thinking that I still have leftover files and directories from when I installed Node without homebrew, but I don't want to start deleting things without fully knowing the repercussions. Would I be safe to delete all files located in the /Users/myusername/.node/ directory? I can't figure out why npm is not installing to the proper directory.
After a little digging, I found that my npm prefix variable was pointing do the wrong directory, left behind by the old Node installation. I ran npm config get prefix to see where it was pointing.
I set the new prefix value using npm config set prefix /usr/local. Homebrew is symlinked with this directory via /usr/local/bin. I uninstalled hexo-cli and reinstalled through npm, and now it works perfectly.
For NVM users
Run nvm use --delete-prefix v10.13.0 --silent replacing v10.13.0 with whatever version of node you're using.
A simple way to cope with environment variables/path problems on Windows:
Run command:
npm install -g hexo
Using node.js command prompt rather than cmd windows provided by Windows itself.

Node Sass couldn't find a binding for your current environment

I am having issues building an app because node-sass keeps failing with the error.
ERROR in Missing binding /Users/warren/Sites/random-docs/my-cms/node_modules/node-sass/vendor/darwin-x64-11/binding.node
Node Sass could not find a binding for your current environment: OS X 64-bit with Node 0.10.x
I have tried running
npm rebuild node-sass
which says
Binary is fine; exiting.
When running node -v I get v6.2.2
Which is different to what the sass error says "Node 0.10.x". I can't figure out why it is getting the wrong version. I have also tried removing the node_modules folder and running npm update or npm install, both of which did not resolve the issue. Any ideas?
I had the same problem
There is an error in your gulpfile:
Error: Missing binding E:\allapp\badshaindiancuisine\node_module\node-sass\vendor\win32-x64-46\binding.node
Node Sass could not find a binding for your current environment:Windows 64-bit with Node.js 4.x
Found bindings for the following environment:
    - OS X 64-bit with Node.js 4.x
How to solve the problem
By going into the project folder and then executing the command:
npm rebuild node-sass
For those that are using Visual Studio:
Currently working for VS 2015, 2017, 2019, 2022 (via below and/or replies from this post)
Task Runner Explorer can't load tasks
For VS 2015
Go to: Tools > Options > Projects and Solutions > External Web Tools
For VS 2017(.3), VS 2019, and VS 2022
Tools > Options > Projects and Solutions > Web Package Management > External Web Tools (per #nothrow)
In VS 2017, 2019, 2022, you also need to put $(PATH) above $(VSINSTALLERDIR)\Web\External
Reorder so that $(PATH) is above $(DevEnvDir)\Extensions\Microsoft\Web Tools\External
Deleting node_modules and running npm install and then npm rebuild node-sass did nothing.
**Just execute: ** npm rebuild node-sass --force
If the above for some reason didn't work out for you, try this:
Delete node-sass folder under node_modules
npm install
In my case it also couldn't find Python.
Following procedure solved the issue (Windows):
npm rebuild node-sass --force
-- cannot find python.exe, if you have Python installed, add it to your path:
set PYTHON=C:\Python27\Python.exe
-- else: download python "Windows x86-64-MSI" installer from https://www.python.org/downloads/release/python-2714/
-- install python
-- at installation start check: add env variable to path
-- after successfull installation:
npm rebuild node-sass --force
-- finished successfully
Worked for me:
Just delete the node-sass folder and run npm install.
I had the same problem in a Windows environment, receiving the following error:
Error: Missing binding C:\Development{ProjectName}\node_modules\node-sass\vendor\win32-ia32-47\binding.node
Node Sass could not find a binding for your current environment: Windows 32-bit with Node.js 5.x
Found bindings for the following environments:
   - Windows 64-bit with Node.js 6.x
None of the npm commands listed in the other answers here (npm install, npm rebuild node-sass, etc.) worked.
Instead, I had to download the missing binding and place it in the appropriate destination folder.
The bindings can be found on git. Match the file with the folder name identified after /node_modules/node-sass/vendor/ in your error message ('darwin-x64-11' in your case, so you'd want the darwin-x64-11_binding.node file).
Create the missing folder in your project (/node_modules/node-sass/vendor/darwin-x64-11), copy the .node file to the new directory, and rename it to binding.node.
Node-sass release URL:
https://github.com/sass/node-sass/releases
I had a similar problem and the reason was that there were two versions of Node installed in my machine: one "global" and another one at the project level.
Sass will build correctly only if the Gulp build is running under Node.js 4.x version, so make sure you upgrade the version of Node you are using.
PS: If you completely remove the node_modules folder in your project and re-build from scratch, npm will download the correct dependencies for your current system & node version.
npm rebuild node-sass --force
Or, if you are using node-sass within a container:
docker exec <container-id> npm rebuild node-sass --force
This error occurs when node-sass does not have the correct binding for the current operating system.
If you use Docker, this error usually happens when you add node_modules directly to the container filesystem in your Dockerfile (or mount them using a Docker volume).
The container architecture is probably different than your current operating system. For example, I installed node-sass on macOS but my container runs Ubuntu.
If you force node-sass to rebuild from within the container, node-sass will download the correct bindings for the container operating system.
See my repro case to learn more.
in some cases you need to uninstall and install node-sass library. Try:
npm uninstall --save node-sass
and
npm install --save node-sass
look at this its work for me,
Stack link here
node-sass node module uses darwin binary file which is dependent on the version of node. This issue occurs when the binary file is not downloaded or wrong binary file is downloaded.
[![Node sass error][1]][1]
Reinstall node modules will download expected binary of node-sass:-
For Mac users:
rm -rf node_modules
npm cache clean --force
npm i
npm rebuild node-sass --force
For Windows users:
rmdir node_modules
npm cache clean --force
npm i
npm rebuild node-sass --force
but for some users, you need to check your node version's compatibility with node-sass version. Make it compatible using below table and run above commands again to fix this issue.
This is node compatibility table with node-sass
NodeJS | Supported node-sass version | Node Module
Node 17 7.0+ 102
Node 16 6.0+ 93
Node 15 5.0+ 88
Node 14 4.14+ 83
Node 13 4.13+, <5.0 79
Node 12 4.12+ 72
Node 11 4.10+, <5.0 67
Node 10 4.9+, <6.0 64
Node 8 4.5.3+, <5.0 57
Node <8 <5.0 <57
If issue is still not fixed, check node-sass supported environment's list:- https://github.com/sass/node-sass/releases/
* Docker related answer here *
Answer for if you are seeing this problem, or something similar, and are using Docker.
Cause: When copying over the current file structure to inside the Docker container, you may be copying over node modules from one OS system to another (e.g. a Mac to Linux container).
Solution:
Add a .dockerignore, and inside add:
node_modules
This will cause an npm install to install the bindings for the docker environment, rather than your local machine environment.
If your terminal/command prompt says:
Node Sass could not find a binding
for your current environment:
OS X 64-bit with Node 0.10.x
and you have tried the following commands such as:
npm cache clean --force
rm -rf node_modules
npm install
npm rebuild node-sass
& still NOTHING works..
Just run this in the terminal manually: node node_modules/node-sass/scripts/install.js
now run npm start or yarn start
Try to add suffix --force
npm rebuild node-sass --force
For my particular case none of the above answers worked. So what it worked:
rm -rf node_modules
rm -rf /tmp/*
rm -rf /root/.npm/node-sass
npm uninstall --save node-sass
npm cache clean --force
npm cache verify to check that nothing is left in the cache
npm install
Altough I haven't tried to reproduce the sequence it was a combination of the above that worked.
In addition you may also try:
npm install --save node-sass or npm install node-sass -g
npm rebuild node-sass
npm install bindings
I had the same problem
throw new Error(errors.missingBinary());
^
Error: Missing binding /path/to/project/node_modules/node-sass/vendor/linux-x64-47/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 5.x
Found bindings for the following environments:
- Linux 64-bit with Node 0.10.x
- Linux 64-bit with Node.js 5.x
That was because I did npm install using a different nodejs version,
try deleting node_modules folder installing and starting
cd your_project
rm -rf node_modules
npm install
npm start or gulp or whatever
If you are using nvm do
nvm use stable // or your favorite version
// remove node_module directory
npm install
npm start or gulp or whatever
I had the same problem with Node v7.4.0 Current (Latest Features).
Did some reading here and downgraded Node to v6.9.4 LTS and after running npm rebuild node-sass it downloaded the binary and everything started working.
Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-48_binding.node
Download complete .] - :
Binary saved to D:\xxx\xxx-xxx\node_modules\node-sass\vendor\win32-x64-48\binding.node
Caching binary to C:\Users\user\AppData\Roaming\npm-cache\node-sass\3.13.1\win32-x64-48_binding.node`
I'm a Windows 8 user, recently updated Node to v8.11.1 and npm to v6.0.0 and faced similar issue. Nothing worked - npm install -g node-sass#latest or deleting the node-sass directory from the project node_modules/ - none of 'em worked for me.
The Laravel Mix was throwing an error to my browser console saying a missing node: win32-x64-57. I don't know whether it's because a slower internet connection or something, the node was missing during the update.
Hence some of the answers directed me to look at the Node-Sass releases, and I found the solution.
Step 1: Check your node-sass version using the command: npm view node-sass version (the {your version} in step 4)
Step 2: Get to Node-Sass Releases
Step 3: Get your release and find the missing node in the assets listed under every release, and download the file
Step 4: Get to your PC's C:\Users\{User}\AppData\Roaming\npm-cache\node-sass\{your version}\ and put the downloaded .node file inside the version folder
And you are done.
In my case the node-sass version was 4.9.0 and the missing node was win32-x64-57_binding.node, so I downloaded the .node file from 4.9.0 release and followed step 4.
For Visual Studio 2015/2017, Right Click on your package.json and Click on Restore Packages.
This will make sure that the npm from the Visual Studio Tools External Tools is run and the binding will be rebuild based on that.
I had the same issue. I couldn't find any proper working solution in here, so I found mine:
Inspired by #Rob-Scott solution and other pointing that we could have 2 versions of Node.js installed, I went to C:\Program Files (x86)\nodejs and realized that I had a node.js version installed in addition to the VS default installation.
My solution was quite simple:
Go to Tools > Options > Projects & solutions > Web package management > External web tools
Click on add an entry (most left of the top-right block of buttons)
Enter C:\Program Files (x86)\nodejs, validate by pressing enter
Bring it at the top of the list
Enjoy
Probably Node.js is not set well in the PATH variable, but this is my working very quick solution, my 2 cents :)
This happens when in your workstation you run an update of Node.js and you are using node-sass globally.
So you should uninstall node-sass globally
npm uninstall -g node-sass
And then you have to install it globally, again
npm install -g node-sass
The post dependencies for node-sass is not getting installed without the package.json inside node-sass
Running it manually solved for me
node node_modules/node-sass/scripts/install.js
credit: link
Run the following commands, it works fine for me.
npm install node-sass -g
npm rebuild node-sass
nvm use 10.16.3
node node_modules/node-sass/scripts/install.js
ng serve --poll=2000
This worked for me:
yarn add --force node-sass#4.14.1 or yarn add --force node-sass
This usually happens because the environment has changed since running npm install.
Running npm rebuild node-sass builds the binding for the current environment.
Create a new directory in node_modules/node-sass/vendor/linux-x64-46/ .
the download fil from https://github.com/sass/node-sass/releases
(linux-x64-59_binding.node) based upon your version.
paste it in node_modules/node-sass/vendor/linux-x64-46/ rename it to binding.node
I had this issue when upgrading from VS 2017 Professional to Enterprise
Close VS
Delete node_modules
Open VS
Right click package.json and select 'restore packages'
Delete node_modules folder.
Install dependencies again. (npm i)
None of the install/rebuild solutions resolved the issue for me (using gulp).
Here is how I resolved it:
1) Download the missing binding file from the repository.
2) Rename the file binding.node.
3) Create node_modules/node-sass/vendor/darwin-x64-11 (path from error message) directory if it doesn't exist.
4) Add the binding file to node_modules/node-sass/vendor/darwin-x64-11
Just refresh your npm cache and:
npm cache clean --force
npm install
It always works for me in the same case.
UPD: Your problem may also be by reason of absence of a global sasslib.
npm install -g sass
Open Visual Studio 2017
Go to Tools -> Options…
Go to Projects and Solutions -> Web Package Management
Move $(PATH) to the top of that list and close that window.
Restart Visual Studio.
This worked in my case, because my node version is 11.x
Probably you have a build with different node version than the current one. Try running these commands and it should fix the issue.
npm cache clean --force &&
rm -rf node_modules &&
rm -rf package-lock.json &&
npm i

Can't get last version of NPM working

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:
npm#1.3.26 C:\Users\ck\AppData\Roaming\npm\node_modules\npm-check-updates\node_modules\npm
npm#2.1.5 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;
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.
Finally able to update npm. A bit uncooperative guy whew! Tried to install / update nom first npm install -g nom#latest then npm install -g npm#latest on admin level console / windows command.
From 1.4.28 to 2.1.7
Weird but hey it works for me!
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\;. This was the problem for me, and was resolved by putting C:\Program Files\nodejs\; at the end of the user path and removing it from the system path. Don't forget to restart the terminal after changing the path. Though useful in helping me to find the problem, none of baaroz's solutions worked in my case.
I deleted this folder C:\Users<username>\AppDa\Roaming\npm and C:\Users<username>\AppDa\Roaming\npm-cache and the did the node.js install and was able to have the updated version of npm

Resources