Skip to content

Instantly share code, notes, and snippets.

@mattlgy
Last active December 16, 2015 03:49
Show Gist options
  • Save mattlgy/5372597 to your computer and use it in GitHub Desktop.
Save mattlgy/5372597 to your computer and use it in GitHub Desktop.
Solutions to common Node.js and npm problems

Installing Node.js and npm

Node and npm should be installed via the package manager, its better this way. Follow this guide: Installing-Node.js-via-package-manager

If you already have node and npm installed, check that it is installed correctly:
apt-cache search ^nodejs$
If that does not return "nodejs - Node.js ..." you might want to consider deleting the current install and re-installing. Feel free to see me (Matt) for help installing on Ubuntu or other Linux distros.

npm install errors

Permission errors while npm installing

You should not need to be sudo to npm install!!!
If you are getting permission errors and it is suggestion running as admin/root, don't do it. There is a better way!
Run the following commands, trust me...

sudo rm -rf <PATH TO SITE>/node_modules
sudo rm -rf ~/.npm
sudo rm -rf ~/tmp/npm-*
sudo chmod <USER NAME> ~/tmp
chmod u+rw ~/tmp

Some error that says something about g++ while installing iconv

sudo apt-get install g++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment