As always installing something on Ubuntu may be a little tricker, this is how I got Node.js & Grunt to install on Ubuntu 12.04
Step-by-step guide
- Use NVM
- nvm install 11
- nvm use 11
Other Weird Stuff
Some other things to watch out for:
- If you have a problem installing dependencies with "npm install", you may see subsequent "npm install" freeze on a step. If you see all the directories in /yourproject/node_modules are empty, deleting those directories and trying "npm install" again may help.
- There can be some strange permissions errors on a Vagrant environment; if you receive an error that mentions chown and asks you to "Please try running this command again as root/Administrator," make sure you're using "npm install" (these errors tend to pop up when trying "sudo npm install"). If the file in question that npm is unable to chown is something like "/home/vagrant/tmp", make sure that tmp directory belongs to the user "vagrant:vagrant" (sometimes it's owned by root:root, which will cause problems).
- If for some reason npm -g install grunt doesnt work run these 2 commands:
sudo chown -R vagrant:vagrant /usr/lib/node_modules
sudo chown -R vagrant:vagrant /home/vagrant/.npm
- Try npm --version again, if it still fails fails do this:
Look at where you ran npm -g install grunt, this will have your Grunt Version, (looks like grunt@0.4.4), mine was:
npm http GET http://registry.npmjs.org/grunt/-/grunt-0.4.4.tgz. You will have to get and unpack the tar manually
- if still no luck, just do this:
- sudo apt-get install npm
- npm config set registry http://registry.npmjs.org/
sudo chown -R vagrant:vagrant /usr/lib/node_modules
sudo chown -R vagrant:vagrant /home/vagrant/.npm
Related articles