Created
December 10, 2014 22:02
-
-
Save JimJafar/d0c11eda77eccc127fc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# before you begin, I suggest you get a list of your globally installed packages so you know what to reinstall later: | |
npm list -g --depth=0 | |
# /usr/lib | |
# ├── [email protected] | |
# ├── [email protected] | |
# ├── [email protected] | |
# ├── [email protected] | |
# └── [email protected] | |
# tell npm to install packages to home (instead of /usr/lib or /usr/local depending on your OS) | |
npm config set prefix ~/npm | |
# now you need to update your path environment variables | |
# open your .bashrc or .bash_profile file for editing | |
nano ~/.bashrc # for Linux | |
# or... | |
nano ~/.bash_profile # for Mac if you haven't created a .bashrc file | |
# add these lines: | |
export PATH="$PATH:$HOME/npm/bin" | |
export NODE_PATH="$NODE_PATH:$HOME/npm/lib/node_modules" | |
# save the file and then enter this command to make the changes take effect: | |
. ~/.bashrc | |
# or... | |
. ~/.bash_profile | |
# check to see if anything is owned by root: | |
ls -la ~/.npm | |
# take ownership of everything in your ~/.npm directory (must be run with sudo): | |
sudo chown -R $USER:`id -g -n $USER` ~/.npm | |
# now you can reinstall all your global packages - no sudo necessary :) | |
npm install -g bower | |
npm install -g grunt-cli | |
npm install -g gulp | |
npm install -g yo | |
# etc. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment