Node.js Grunt tool installing troubleshoot

Some time ago I installed node.js

#apt-get install nodejs

#apt-get install npm

Since I discovered the Grunt tool for working with my web site assets I tried to install command line grunt:

#npm install -g grunt-cli

The problem was I had outdated version on npm (0.6.12)—and I got the following error:

npm ERR! Error: failed to fetch from registry: grunt-cli

To resolve—I needed to install newer version of npm and I found suggested resolution online:

#npm cache clean -f

#npm install -g n

#npm http GET https://registry.npmjs.org/n

But this lead to different problems again, since I had no curl installed; and basically I resolved all problems except:

#n stable

#node -v

Node version was still the old one.

Final solution was to:

apt-get install python-software-properties

apt-add-repository ppa:chris-lea/node.js

apt-get update

apt-get remove nodejs

apt-get install nodejs

where

node -v returned

v0.10.28

npm -v returned

1.4.9

</code>

After that

# npm install -g grunt-cli

went just fine.

Thanks

tags: & category: -