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.
All platforms (Windows, Mac & Linux)
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.
just try this on your terminal :
nvm install node --reinstall-packages-from=node
it should do the trick.
later, run node --version to check the version that you have.
Using brew and nvm on Mac OSX:
If you're not using nvm, first uninstall nodejs. Then install Homebrew if not already installed. Then install nvm and node:
You can now easily switch node versions when needed.
Bonus: If you see a "tar: invalid option" error when using nvm,
brew install gnu-tar
and follow the instructions brew gives you to set your PATH.Linux/Mac:
The module
n
makes version-management easy:For the latest stable version:
For the latest version:
Windows:
just reinstall node from the .msi in Windows from the node website.
via npm:
and also you can specify a desired version:
reference
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 upgrade 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