Earlier when today I tried to install StrongLoop's loopback framework on my ubuntu 14.04 machine via npm. I was getting a bunch of errors & messages about permissions, bugs etc.
I did carefully go through all the errors messages and tried to solve them. I ended up deleting all my installed packages, reparing ownership, permissions, reading stackoverflow threads, reinstalling npm & node. I was able to install one or two package then its the same errors again. Moral : 3 hours wasted.
Solutuion that worked :
- Complie node from source and install it locally (That means no sudo).
- And never run a (All global package update)
npm update -gever.
Trust me it's better this way!
The procedure :
Download and install node :
$ mkdir ~/local $ cd /tmp $ mkdir node_install $ cd node_install $ curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 $ ./configure --prefix=~/local $ make install
~/local/bin to your path :
For BASH users :
$ echo 'export PATH="$HOME/local/bin:$PATH" # Local Packages Path' >> ~/.bashrc
For ZSH users like me :
$ echo 'export PATH="$HOME/local/bin:$PATH" # Local Packages Path' >> ~/.zshrc
Install Latest NPM :
$ curl -L https://npmjs.org/install.sh | sh $ node -v $ npm -v
Now you wont have to worry about permissions and sudo. All your packages and stuff will be kept in
~/local directory & remember that a (All global package update)
npm update -g is not necessary.
NPM suggests now to upgrade it using:
npm install -g npm@latest
Subscribe to console.log('blog')
Get the latest posts delivered right to your inbox