Open Jacobvu84 opened 5 years ago
.profile
export PATH=~/.npm-global/bin:$PATH
.bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
export M2_HOME=$/usr/local/Cellar/maven/3.5.4
export ANDROID_SDK_ROOT=/Users/jacob/Library/Android/skd
PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/build-tools/28.0.2
Create .npmrc
prefix=~/.npm-global
docs.npmjs.com
If you see an EACCES error when you try to install a package globally, you can either:
Reinstall npm with a node version manager
This is the best way to avoid permissions issues. To reinstall npm with a node version manager, follow the steps in "Downloading and installing Node.js and npm". You do not need to remove your current version of npm or Node.js before installing a node version manager.
Manually change npm’s default directory
To minimize the chance of permissions errors, you can configure npm to use a different directory. In this example, you will create and use hidden directory in your home directory.
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
npm install -g appium
Instead of steps 2-4, you can use the corresponding ENV variable (e.g. if you don’t want to modify ~/.profile):NPM_CONFIG_PREFIX=~/.npm-global