How to Update node.js from 0.10.xx to 4.6? - node.js

I've install node in my Laravel project using yum --enablerepo=epel install nodejs npm.
node -v tells me i'm at version v0.10.36
Now I wanted version 4.6, but not sure how to get it installed.
Then I found these instructions, tried them:
npm cache clean -f
npm install -g n
n stable
and got:
install : node-v6.6.0
mkdir : /usr/local/n/versions/node/6.6.0
fetch : https://nodejs.org/dist/v6.6.0/node-v6.6.0-linux-x64.tar.gz
######################################################################## 100.0%
installed : v6.6.0
When I do node -v, I still get v0.10.36
Should I uninstall node with yum and try something else?
Will uninstalling break something in my Laravel project?
Thanks

Try removing node first, then do a clean install.

Use nvm https://github.com/creationix/nvm which is the Node Version Manager. It makes it much easier to switch versions. Then you will need to test your code again to see if there are any breaking compatibility issues and review the newer version of the docs.
BTW as of writing, Node v7 is in beta and brings some significant optimizations over the version you are currently upgrading too.

Related

Error npm is known not to run on Node.js v10.24.1 and how to fix it, don't update to the latest version?

I run : npm run dev
Error : npm is known not to run on Node.js v10.24.1
I have researched and know the command: npm install -g npm#latest and some other commands to fix the problem
But the problem is that my project is using nodejs 10 so it can't use the latest nodejs. So is there any way to fix the above error. Thank you
UPDATE :
I use nvm to install and manage versions of nodejs. And my OS is macOs
The problem for me was upgrading my global version of npm while on an incompatible version of Node (8.16.1).
I tried to uninstall npm globally but that also didn't work because I could not use the npm command.
To fix it, I used nvm to switch to a compatible version of Node (nvm use 14.0.0 - this can be any version of Node compatible with the npm version you have installed globally). This allowed me to run npm commands so I ran npm uninstall -g npm first of all to remove my global version of npm and then nvm uninstall 8.16.1 to remove my faulty Node version.
I was then able to reinstall Node 8.16.1 (nvm install 8.16.1), and with it came a fresh install of a compatible npm version.
I happen to work on a project that builds on node 10 as well.
More details would have been helpful to understand the problem better but I suspect it's a compatibility issue.
Try these:
Download and install the latest version of nodejs.
Open you terminal and verify you have the latest version using node -v. Verify your npm version too using npm -v.
Since you have nvm installed, run nvm install 10, then nvm use 10.
Verify your versions again. In my case, node is v10.24.1 & npm is 6.14.12.
Start your app using npm run dev. Please check you package.json to be sure you are using the right startup command.
I was having the same problem, I ran the command and it solved the problem with NPM
sudo n latest
Node: v10.19.0
NPM: 8.9.0
Reference
I performed an upgrade of npm by mistake and run into the same issue.
The only way to solve for me was to delete the two following directories:
C:\Users\<username>\AppData\Roaming\npm
C:\Users\<username>\AppData\Roaming\npm-cache
npm is known not to run on Node.js v10.24.1 comes when normally people upgrade the version of npm to latest or recent ones, but when it comes to node 10 version you can use npm version 6.4.1 or 6 series. Normally npm 6.4.1 will come with node js 10.24.1 but if you have given any npm update cmd you need to go to C:\Users\username\AppData\Roaming and delete npm and npm cache folders then delete npm folders in C:\Users\username\AppData\local then check the npm version using npm -v. After doing this install the angular version
Thanks #Oduola Olumide Sunday for the response. I have followed your way but still not solved the problem.
And I fix it by removing the latest nodejs version and using the normal node v10.24.1
enter link description here ->
I removed the latest nodejs version with this
This error happens when your npm version is not what you think it is...
For instance, you download a nodejs pkg and install. Run node -v, npm -v... npm -v provides the error that brought you here.
This means your aren't using the version the nodejs pkg installed, but some remnant somewhere- from other install attempts.
In my case, I had a Homebrew installed version of npm that I didn't realize existed.
You can find the locations, at least on mac, using the 'where' command.
where npm
Which will return path(s) of your npm locations. Find the one that doesn't belong and give it the boot.
Then your npm -v will return the expected version number output.
Now you can execute npm commands.
I had the same problem.
I was using node 12 with nvm
Then, I switched to node 16, uninstalled the version 12 with nvm uninstall 12 and then I installed it again with nvm install 12 and it is working fine
For nvm used under macOS, I solve this issue in this way
First, run nvm ls-remote to get the latest version of v10
-> v10.24.1 (Latest LTS: Dubnium)
Then install the latest version of v10 through
nvm install 10.24.1 --latest-npm
In case anyone here needs to install an npm version (7.24.2) that does support node 10, rather than upgrade node.
Here is what I did:
url=`(curl -qSsL https://registry.npmjs.org/npm/7.24.2; echo "") | sed -e 's/^.*tarball":"//' | sed -e 's/".*$//'`
curl -qSsL -o npm.tgz "$url"
bin/npm-cli.js install -gf ../npm.tgz # in case npm is not installed where "which npm" points to, you might need to add --prefix=$(which npm | sed 's/\/bin\/npm//')
The reference is the installation script of 7.24.2 https://github.com/npm/cli/blob/v7.24.2/scripts/install.sh
In my case I had put ^ in one of the package version in my package.json. Which takes latest version of that library and it was not compatible to older npm version which caused me this error.
Remove all ^ from package versions and try again.
your nodejs version should come with its own npm that it supports.so if your machine has issues finding the npm version go to cdrive C:\Users\Machine name\AppData\Roaming
delete npm and npm cache folders.
Try below command
brew install node
then
npm install
None of the tips I found here helped.
I had to reinstall nvm.

Upgrading to a specific node js version

I am trying to upgrade my node to version 14.17.1 by running:
npm install -g node#14.17.1
It succeeds apparently, but when I run node -v, I still get the old version.
Is there an extra step I should take, or am I doing this wrong?
It is good to use a excellent and proven source. Visit official nodejs.org website and go to:
Other Downloads
Previous Releases - link
Choose and Install version whatever You want, on Operating System You
actually using. Good Luck ;-)
Or install and use nvm
To download, compile, and install the latest release of node, do this:
nvm install node # "node" is an alias for the latest version
To install a specific version of node:
nvm install 14.7.0 # or 16.3.0, 12.22.1, etc

How to update nodejs version [duplicate]

This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
I did the following to update my npm:
npm update npm -g
But I have no idea how to update Node.js. Any suggestions? (I'm using Node.js 0.4.1 and want to update to Node.js 0.6.1.)
To upgrade Node you may first want to see which version of Node.js you are currently using:
node --version
Find out which versions of Node.js you may have installed and which one of those you're currently using:
nvm ls
List all versions of Node.js available for installation:
nvm ls-remote
Apparently for Windows the command would be rather like this:
nvm ls available
Assuming you would pick Node.js v8.1.0 for installation you'd type the following to install that version:
nvm install 8.1.0
You are then free to choose between installed versions of Node.js. So if you would need to use an older version like v4.2.0 you would set it as the active version like this:
nvm use 4.2
That should be all.
In 2013 I used the following instructions to upgrade from Node.js version 0.10.6 to 0.10.21 on a Mac, for more recent instructions see above.
Update from 2017: Please mind, Mr. Walsh himself recommended to update Node.js just using nvm instead.
Clear NPM's cache:
sudo npm cache clean -f
Install a little helper called 'n'
sudo npm install -g n
Install latest stable Node.js version
sudo n stable
Alternatively pick a specific version and install like this:
sudo n 0.8.20
For production environments you might want to pay attention to version numbering and be picky about odd/even numbers.
Credits
General procedure: D.Walsh
Stable/unstable versions: P.Teixeira
Use Node Version Manager (NVM)
It's a Bash script that lets you download and manage different versions of node. Full source code is here.
There is a separate project for nvm for Windows: github.com/coreybutler/nvm-windows
Below are the full steps to use NVM for multiple version of node on windows
download nvm-setup.zip extract and install it.
execute command nvm list available from cmd or gitbash or powershell, this will list all available version of node
use command nvm install version e.g. nvm install 12.14.0 to install on the machine
last once installed use nvm use version to use newer version e.g. nvm use 12.14.0
Any OS (including Windows, Mac & Linux)
Updated October 2022
Just go to the official Node.js site (nodejs.org), download and execute the installer program.
It will take care of everything and with a few clicks of 'Next' you'll get the latest Node.js version running on your machine. Since 2020 it's the recommended way to update NodeJS. It's the easiest and least frustrating solution.
Pro tips
NodeJS installation includes NPM (Node package manager).
To check your NPM version use npm version or node --version.
If you prefer CLI, to update NPM use npm install -g npm and then npm install -g node.
For more details, see the docs for install command.
Keep an eye on NodeJS blog - Vulnerabilities so you don't miss important security releases. Keep your NodeJS up-to-date.
Operating systems supported by Node.js:
Windows, Linux, MacOS, IBM AIX.
For Docker users, here's the official Node.js image.
For more information on installing Node.js on a variety of less-common operating systems, see this page (there's even Node for Android!).
Troubleshooting for Windows:
If anyone gets file error 2502/2503 like myself during install, run
the .msi via Administrator command prompt with command msiexec /package [node msi]
If my answer is helpful, don't forget to upvote it
(here is the original answer by Anmol Saraf, upvote it too)
If you have Homebrew installed (only for macOS):
$ brew upgrade node
2021: Just go to nodejs.org and use the latest installer.
That's it folks. It used to be more complex and people used different kinds of packages and strategies to manage it. But things have changed for the better.
Works for all platforms (Windows, Mac & Linux).
First update npm,
npm install -g npm stable
Then update node,
npm install -g node or npm install -g n
check after version installation,
node --version or node -v
On Windows you can use Chocolatey to install and update Node.js (and lots of other packages).
Install Node
cinst nodejs.install
Update Node
cup nodejs.install
Note: You will need to install Chocolatey before you can use cinst and cup.
To upgrade node to the latest version or to a specific version you can do the following:
sudo npm install n -g
sudo n 0.10.18 // This will give you the specific version
For the latest stable version:
sudo n stable
For the latest LTS version(Tested on Mac)
sudo n lts
To control your version of Node.js, you can try n. I found it very straightforward and useful.
n is a Node.js binary management, no subshells, no profile setup, no convoluted API, just simple.
npm install -g n
n 0.6.19 will install Node.js v0.6.19.
Short answer:
Go to this page: Download | Node.js
Download the installer for your platform, then install it.
I had the same problem, when I saw that my Node.js installation is outdated.
These few lines will handle everything (for Ubuntu):
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
After this node -v will return you the latest available version.
On CentOS 7 you can do the following:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/5.4.1/bin/node /usr/bin/node
node –v (Should show updated version now)
npm rebuild node-sass (Optional: if you use this)
Note: The symlink is required to link your node binary with the latest Node.js installed binary file.
For OS X, I had v5.4.1 and needed the latest version 6 so I went to the Node.js homepage and clicked on one of the links below:
I then followed the installer and then I magically had the latest version of Node.js and npm.
For macOS in 2018+
(as ALL of the solutions above are failing for me):
Simply go to the official nodejs site, download the official nodejs package and install it by double clicking. It's the most simple, safe and always-working thing you can do.
You may use nvm.
Check what is the latest version at http://nodejs.org/ (e.g. v0.10.26)
Run nvm install v0.10.26
Done.
You can choose which version to run:
nvm ls list the available versions and tells you which version you are using now.
nvm use VERSION change the current node to the requested version.
nvm alias default VERSION set the default version. The next time you source nvm.sh, this will be the version loaded (note that it doesn't change the version in use right now, run nvm use for that).
Some Linux distributions such as Arch Linux have Node.js in their package repositories. On such systems it is better to use a standard package update procedure, such as pacman -Suy or analogous apt-get or yum commands.
As of now (Nov 2016) EPEL7 offers a pretty recent version of Node.js (6.9.1 which is an up-to-date LTS version offered on the Node.js home page). So on CentOS 7 and derivatives you can just add EPEL repository by yum install epel-release and yum install nodejs.
CentOS 6/EPEL6 has 0.10.x which isn't supported upstream since Oct 2016.
Today I ran on a Windows Git Bash:
$ npm i node -g
and got the following output:
> node#10.6.0 preinstall C:\Users\X\AppData\Roaming\npm\node_modules\node
> node installArchSpecificPackage
+ node-win-x64#10.6.0
added 1 package and audited 1 package in 23.368s
found 0 vulnerabilities
C:\Users\X\AppData\Roaming\npm\node -> C:\Users\X\AppData\Roaming\npm\node_modules\node\bin\node
+ node#10.6.0
added 2 packages from 1 contributor in 26.089s
Read more about it at https://www.npmjs.com/package/node.
The easy way to update node and npm :
npm install -g npm#latest
download the latest version of node js and update /install
$ npm install -g npm stable
worked for me to update npm
Install nvm(cURL)
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
OR with Wget
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
Display list of installed versions
$ nvm ls
Display list of versions that are available to install
$ nvm ls-remote
Install your preferred version
$ nvm install v7.5.0
Set this version as the default
$ nvm alias default v7.5.0
For Ubuntu:
sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs
Source: https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version
You may use Chocolatey on Windows. It's very easy to use and useful for keeping you updated with other applications too.
Also, you can just simply download the latest version from https://nodejs.org and install it.
According to Nodejs Official Page, you can install&update new node version on windows using Chocolatey or Scoop
Using(Chocolatey):
cinst nodejs
# or for full install with npm
cinst nodejs.install
Using(Scoop):
scoop install nodejs
Also you can download the Windows Installer directly from the nodejs.org web site
As some of you already said, the easiest way is to update Node.js through the Node.js package manager, npm. If you are a Linux (Debian-based in my case) user I would suggest to add these lines to your .bashrc file (in home directory):
function nodejsupdate() {
ARGC=$#
version=latest
if [ $ARGC != 0 ]; then
version=$1
fi
sudo npm cache clean -f
sudo npm install -g n
sudo n $version
}
Restart your terminal after saving and write nodejsupdate to update to the latest version of Node.js or nodejsupdate v6.0.0 (for example) to update to a specific version of Node.js.
BONUS: Update npm (add these lines to .bashrc)
function npmupdate() {
sudo npm i npm -g
}
After restarting the terminal write npmupdate to update your node package manager to the latest version.
Now you can update Node.js and npm through your terminal (easier).
In windows download the node executable file from the website and install it. this worked for me.
All you need to version update of Node.js:
$ brew install node
If you don't have Homebrew; please go http://brew.sh/.
Just install the new version over the current folder. I upgraded mine from v4.x to v6.10 on Windows.
npm clean cache - you forget to clean ur cache
npm update -g
This works on mine Windows, I hope it will also work for you :D
If you want to update Node.js, just try
npm update
from your Windows cmd prompt.
Else if you want to update any specific package try
npm update <package_name>
Example:
npm update phonegap
open cmd and type
npm i -g npm

nodejs 4.2.6 not getting updated to latest version

I installed Node and npm as they are required to install angular cli.
Now, if I type this command:
npm install -g angular-cli
I get this message in terminal:
ERROR: npm is known not to run on Node.js v4.2.6 Node.js 4 is supported but the specific version you're running has a bug known to break npm. Please update to at least 4.7.0 to use this version of npm. You can find the latest release of Node.js at https://nodejs.org/
I also followed this link, but still the issue is not resolved.
I tried removing node, npm and then reinstalling, updating node according to all the ways I found on internet, but still the version(4.2.6) is same.
I don't understand what I am doing wrong as I am new to Linux.
Surprisingly, npm is quite complicated in Linux, until you discover Node Version Manager which allows you to easily install new versions and swap between them.
After installing nvm, you can install any node version with nvm install <VERSION_NUMBER> and you can set it as default with nvm alias default <VERSION_NUMBER>
You can swap between versions using nvm use <VERSION_NUMBER>

How do I update Node.js?

This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
I did the following to update my npm:
npm update npm -g
But I have no idea how to update Node.js. Any suggestions? (I'm using Node.js 0.4.1 and want to update to Node.js 0.6.1.)
To upgrade Node you may first want to see which version of Node.js you are currently using:
node --version
Find out which versions of Node.js you may have installed and which one of those you're currently using:
nvm ls
List all versions of Node.js available for installation:
nvm ls-remote
Apparently for Windows the command would be rather like this:
nvm ls available
Assuming you would pick Node.js v8.1.0 for installation you'd type the following to install that version:
nvm install 8.1.0
You are then free to choose between installed versions of Node.js. So if you would need to use an older version like v4.2.0 you would set it as the active version like this:
nvm use 4.2
That should be all.
In 2013 I used the following instructions to upgrade from Node.js version 0.10.6 to 0.10.21 on a Mac, for more recent instructions see above.
Update from 2017: Please mind, Mr. Walsh himself recommended to update Node.js just using nvm instead.
Clear NPM's cache:
sudo npm cache clean -f
Install a little helper called 'n'
sudo npm install -g n
Install latest stable Node.js version
sudo n stable
Alternatively pick a specific version and install like this:
sudo n 0.8.20
For production environments you might want to pay attention to version numbering and be picky about odd/even numbers.
Credits
General procedure: D.Walsh
Stable/unstable versions: P.Teixeira
Use Node Version Manager (NVM)
It's a Bash script that lets you download and manage different versions of node. Full source code is here.
There is a separate project for nvm for Windows: github.com/coreybutler/nvm-windows
Below are the full steps to use NVM for multiple version of node on windows
download nvm-setup.zip extract and install it.
execute command nvm list available from cmd or gitbash or powershell, this will list all available version of node
use command nvm install version e.g. nvm install 12.14.0 to install on the machine
last once installed use nvm use version to use newer version e.g. nvm use 12.14.0
Any OS (including Windows, Mac & Linux)
Updated October 2022
Just go to the official Node.js site (nodejs.org), download and execute the installer program.
It will take care of everything and with a few clicks of 'Next' you'll get the latest Node.js version running on your machine. Since 2020 it's the recommended way to update NodeJS. It's the easiest and least frustrating solution.
Pro tips
NodeJS installation includes NPM (Node package manager).
To check your NPM version use npm version or node --version.
If you prefer CLI, to update NPM use npm install -g npm and then npm install -g node.
For more details, see the docs for install command.
Keep an eye on NodeJS blog - Vulnerabilities so you don't miss important security releases. Keep your NodeJS up-to-date.
Operating systems supported by Node.js:
Windows, Linux, MacOS, IBM AIX.
For Docker users, here's the official Node.js image.
For more information on installing Node.js on a variety of less-common operating systems, see this page (there's even Node for Android!).
Troubleshooting for Windows:
If anyone gets file error 2502/2503 like myself during install, run
the .msi via Administrator command prompt with command msiexec /package [node msi]
If my answer is helpful, don't forget to upvote it
(here is the original answer by Anmol Saraf, upvote it too)
If you have Homebrew installed (only for macOS):
$ brew upgrade node
2021: Just go to nodejs.org and use the latest installer.
That's it folks. It used to be more complex and people used different kinds of packages and strategies to manage it. But things have changed for the better.
Works for all platforms (Windows, Mac & Linux).
First update npm,
npm install -g npm stable
Then update node,
npm install -g node or npm install -g n
check after version installation,
node --version or node -v
On Windows you can use Chocolatey to install and update Node.js (and lots of other packages).
Install Node
cinst nodejs.install
Update Node
cup nodejs.install
Note: You will need to install Chocolatey before you can use cinst and cup.
To upgrade node to the latest version or to a specific version you can do the following:
sudo npm install n -g
sudo n 0.10.18 // This will give you the specific version
For the latest stable version:
sudo n stable
For the latest LTS version(Tested on Mac)
sudo n lts
To control your version of Node.js, you can try n. I found it very straightforward and useful.
n is a Node.js binary management, no subshells, no profile setup, no convoluted API, just simple.
npm install -g n
n 0.6.19 will install Node.js v0.6.19.
Short answer:
Go to this page: Download | Node.js
Download the installer for your platform, then install it.
I had the same problem, when I saw that my Node.js installation is outdated.
These few lines will handle everything (for Ubuntu):
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
After this node -v will return you the latest available version.
On CentOS 7 you can do the following:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/5.4.1/bin/node /usr/bin/node
node –v (Should show updated version now)
npm rebuild node-sass (Optional: if you use this)
Note: The symlink is required to link your node binary with the latest Node.js installed binary file.
For OS X, I had v5.4.1 and needed the latest version 6 so I went to the Node.js homepage and clicked on one of the links below:
I then followed the installer and then I magically had the latest version of Node.js and npm.
For macOS in 2018+
(as ALL of the solutions above are failing for me):
Simply go to the official nodejs site, download the official nodejs package and install it by double clicking. It's the most simple, safe and always-working thing you can do.
You may use nvm.
Check what is the latest version at http://nodejs.org/ (e.g. v0.10.26)
Run nvm install v0.10.26
Done.
You can choose which version to run:
nvm ls list the available versions and tells you which version you are using now.
nvm use VERSION change the current node to the requested version.
nvm alias default VERSION set the default version. The next time you source nvm.sh, this will be the version loaded (note that it doesn't change the version in use right now, run nvm use for that).
Some Linux distributions such as Arch Linux have Node.js in their package repositories. On such systems it is better to use a standard package update procedure, such as pacman -Suy or analogous apt-get or yum commands.
As of now (Nov 2016) EPEL7 offers a pretty recent version of Node.js (6.9.1 which is an up-to-date LTS version offered on the Node.js home page). So on CentOS 7 and derivatives you can just add EPEL repository by yum install epel-release and yum install nodejs.
CentOS 6/EPEL6 has 0.10.x which isn't supported upstream since Oct 2016.
Today I ran on a Windows Git Bash:
$ npm i node -g
and got the following output:
> node#10.6.0 preinstall C:\Users\X\AppData\Roaming\npm\node_modules\node
> node installArchSpecificPackage
+ node-win-x64#10.6.0
added 1 package and audited 1 package in 23.368s
found 0 vulnerabilities
C:\Users\X\AppData\Roaming\npm\node -> C:\Users\X\AppData\Roaming\npm\node_modules\node\bin\node
+ node#10.6.0
added 2 packages from 1 contributor in 26.089s
Read more about it at https://www.npmjs.com/package/node.
The easy way to update node and npm :
npm install -g npm#latest
download the latest version of node js and update /install
$ npm install -g npm stable
worked for me to update npm
Install nvm(cURL)
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
OR with Wget
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
Display list of installed versions
$ nvm ls
Display list of versions that are available to install
$ nvm ls-remote
Install your preferred version
$ nvm install v7.5.0
Set this version as the default
$ nvm alias default v7.5.0
For Ubuntu:
sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs
Source: https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version
You may use Chocolatey on Windows. It's very easy to use and useful for keeping you updated with other applications too.
Also, you can just simply download the latest version from https://nodejs.org and install it.
According to Nodejs Official Page, you can install&update new node version on windows using Chocolatey or Scoop
Using(Chocolatey):
cinst nodejs
# or for full install with npm
cinst nodejs.install
Using(Scoop):
scoop install nodejs
Also you can download the Windows Installer directly from the nodejs.org web site
As some of you already said, the easiest way is to update Node.js through the Node.js package manager, npm. If you are a Linux (Debian-based in my case) user I would suggest to add these lines to your .bashrc file (in home directory):
function nodejsupdate() {
ARGC=$#
version=latest
if [ $ARGC != 0 ]; then
version=$1
fi
sudo npm cache clean -f
sudo npm install -g n
sudo n $version
}
Restart your terminal after saving and write nodejsupdate to update to the latest version of Node.js or nodejsupdate v6.0.0 (for example) to update to a specific version of Node.js.
BONUS: Update npm (add these lines to .bashrc)
function npmupdate() {
sudo npm i npm -g
}
After restarting the terminal write npmupdate to update your node package manager to the latest version.
Now you can update Node.js and npm through your terminal (easier).
In windows download the node executable file from the website and install it. this worked for me.
All you need to version update of Node.js:
$ brew install node
If you don't have Homebrew; please go http://brew.sh/.
Just install the new version over the current folder. I upgraded mine from v4.x to v6.10 on Windows.
npm clean cache - you forget to clean ur cache
npm update -g
This works on mine Windows, I hope it will also work for you :D
If you want to update Node.js, just try
npm update
from your Windows cmd prompt.
Else if you want to update any specific package try
npm update <package_name>
Example:
npm update phonegap
open cmd and type
npm i -g npm

Resources