Lauri's notes

Npm

Do not use sudo for global packages!

# Create a directory for your global packages
mkdir $HOME/.local/npm

# Reference this directory for future usage
echo 'export NPM_PACKAGES=$HOME/.local/npm' >> .profile
echo 'export NODE_PATH=$NPM_PACKAGES/lib/node_modules:$NODE_PATH' >> .profile
echo 'export PATH=$NPM_PACKAGES/bin:$PATH' >> .profile
echo "prefix=$HOME/.local/npm" >> .npmrc

Tags: npm

Have an update or suggestion for this note? You can edit it and send me a pull request.

Since 2009 to 2015