Skip to content

Instantly share code, notes, and snippets.

@arcostasi
Last active July 27, 2016 12:08
Show Gist options
  • Save arcostasi/81e6f6fd73e04656d349410532288d54 to your computer and use it in GitHub Desktop.
Save arcostasi/81e6f6fd73e04656d349410532288d54 to your computer and use it in GitHub Desktop.
How to use npm global without sudo on OSX

Checking Your Files When you are done, you should have a files that looks something like the following:

~/.npmrc prefix="${HOME}/.npm-packages"

~/.bashrc NPM_PACKAGES="${HOME}/.npm-packages"
NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
PATH="$NPM_PACKAGES/bin:$PATH"

~/.bash_profile Make sure you have the source ~/.bashrc in your ~/.bash_profile

To see the files beginning with . such as .bashrc and .npmrc you need to show hidden files for OSX. In terminal run the following command: defaults write com.apple.finder AppleShowAllFiles YES Verification

Run these commands to test if you were successful:

Run node -v to see the version of node Run npm -v to see the version of npm Run npm list -g --depth=0 to see the global npm packages you have installed (should just be npm right now)

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