So, I have Node.js installed and now when I tried to install Mongoosejs I got an error telling me that I don't have the needed version of Node.js (I have v0.4.11 and v0.4.12 is needed).
How can I upgrade to this version? I suppose I just could install it again with the latest version, but I don't want to do it before I'm sure that my project folders in the folder "node" won't be deleted.
The module n
makes version-management easy:
sudo npm install n -g
sudo n 0.12.2
For the latest stable version:
sudo n stable
just reinstall node from the .msi in Windows from the node website.
The Current/Stable version of node is v0.12.2 (2015-05-02) see: nodejs.org
Review of the node mailing list indicates that using NVM (Node Version Manager) is the best way to manage your nodejs versioning/upgrading. see: github.com/creationix/nvm usage:
git clone git://github.com/creationix/nvm.git ~/nvm
. ~/nvm/nvm.sh
Then you can install a specific version of NodeJS using the nvm command:
nvm install v0.12.2
followed by:
nvm use v0.12.2
I can't see a specific advantage of using NVM from creationix (Tim Caswell) over N from visionmedia (TJ Holowaychuk) github.com/visionmedia/n other than the verboseness of NVM's commands if you keep a Terminal/SSH Log - otherwise they appear functionally equivalent. I will point out that NVM does have more than twice the number of GitHub followers that N has (3224 and 1118 respectively) that's usually - but not always - a sign of a better module... feel free to correct if you know better. ;-)
P.S. this may be a dupe of How can I uninstall or upgrade my old node.js version?
via npm:
# npm cache clean -f
# npm install -g n
# n stable
and also you can specify a desired version:
# n 0.8.21
my 2c:
I tried both with n and with nvm on Linux Ubuntu 12.04 LTS, in order to update node from v0.8.25 to v0.10.22.
The first one was successfully completed, but the command 'which node' resulted in the old v0.8.25.
The second one was successfully completed and the same command resulted in v.0.10.22.
On Windows download latest "Windows Installer (.msi)" from http://nodejs.org/download/ and install same directory , thats all...
After complete the installation above, the NodeJS and NPM will be upgraded to the latest one and then you can cleanup the package as normal as:
npm cache clean
npm update -g
Note
You can always check the version with following command:
C:\node -v
v0.12.4
C:\npm -version
2.10.1
Upgrading node.js to the latest version on Windows
Install chocolatey if you haven't already: Installing Chocolatey
From the command prompt, type
cup nodejs
(which is equivalent to typing choco update nodejs
-- assumes you already have node installed)
NOTE: You may need to run cinst nodejs.install
for chocolatey to register your existing installation. (thanks for the comment, @mikecheel)
Installing node.js on Windows
If you have never installed node, you can use chocolatey to do that as well. Install chocolatey (see step 1 above). Then from a command prompt, type:
cinst nodejs.install
Chocolatey Gallery Node JS (Install)
Installing a specific version of node on Windows with chocolatey
cinst nodejs.install -Version 0.10.26
brew upgrade node
Which produces:
Andrews-MacBook-Air :: ~/dev/cookiecutter-ionic ‹master*› » brew upgrade node
==> Upgrading 1 outdated package, with result:
node 0.12.7
==> Upgrading node
==> Downloading https://homebrew.bintray.com/bottles/node-0.12.7.yosemite.bottle
######################################################################## 100.0%
==> Pouring node-0.12.7.yosemite.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
/usr/local/Cellar/node/0.12.7: 2726 files, 31M