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.)
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.)
All platforms (Windows, Mac & Linux)
Just go to nodejs.org and download the latest installer. It couldn't be any simpler honestly, and without involvement of any third-party stuff. It only takes a minute and does not require you to restart anything or clean out caches, etc.
I've done it via npm a few times before and have run into a few issues. Like for example with the n-package not using the latest stable release.
On Windows you can use Chocolatey to install and update Node.js (and lots of other packages).
Install Node
Update Node
Note: You will need to install Chocolatey before you can use
cinst
andcup
.To control your version of Node.js, you can try n. I found it very straightforward and useful.
n 0.6.19
will install Node.js v0.6.19.For Ubuntu:
Source: https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version
I used the following instructions to upgrade from Node.js version 0.10.6 to 0.10.21 on a Mac.
Clear NPM's cache:
Install a little helper called 'n'
Install latest stable Node.js version
Alternatively pick a specific version and install like this:
For production environments you might want to pay attention to version numbering and be picky about odd/even numbers.
Credits
Update (June 2017):
This four years old post still receives up-votes so I'm guessing it still works for many people. However, Mr. Walsh himself recommended to update Node.js just using nvm instead.
So here's what you might want to do today:
Find out which version of Node.js you are using:
Find out which versions of Node.js you may have installed and which one of those you're currently using:
List all versions of Node.js available for installation:
Apparently for Windows the command would be rather like this:
Assuming you would pick Node.js v8.1.0 for installation you'd type the following to install that version:
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:
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):Restart your terminal after saving and write
nodejsupdate
to update to the latest version of Node.js ornodejsupdate v6.0.0
(for example) to update to a specific version of Node.js.BONUS: Update npm (add these lines to
.bashrc
)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).