Using node.js 0.4.x with npm 1.0.x via nvm

I ran across this problem and found the following question on stackoverflow:

How can I change the version of npm using nvm?

Here’s my response:

nvm doesn’t handle npm.

So if you want to install node 0.4.x (which many packages still depend on) and use NPM, you can still use npm 1.0.x.

Install node 0.6.x (which comes with npm 1.1.x) and install nvm with npm:


npm install nvm 
. ~/nvm/nvm.sh 

Install node 0.4.x with nvm:


nvm install v0.4.12 
nvm use v0.4.12 

Install npm using install.sh:

curl http://npmjs.org/install.sh | sh 

This will detect node 0.4.12 and install npm 1.0.106 in your ~/nvm/v0.4.12/lib/node_modules folder and create symlink for nvm

~/nvm/v0.4.12/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js 

If you try to run npm, it will still give an error but if you do nvm use v0.4.12 again, it should now work.

2 thoughts on “Using node.js 0.4.x with npm 1.0.x via nvm

    1. That’s what I post for — though usually I expect to be the only one who finds it useful, when I forget how I solved a problem previously, I search my blog.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s