Only add npm path if it exists

This commit is contained in:
ViViDboarder 2019-11-09 12:35:17 -08:00
parent 7ec01997c1
commit 72d5ffaa4f
2 changed files with 9 additions and 4 deletions

View File

@ -66,10 +66,12 @@ elif [ -d "$HOME/.rvm" ]; then
fi
# NPM paths
# On mac the path should already be taken care of
if type npm &> /dev/null && [ $DET_OS != "mac" ]; then
if type npm &> /dev/null ; then
# This seems to fail in some cases
export PATH=$PATH:$(npm bin -g 2> /dev/null)
npm_path=$(npm bin -g 2> /dev/null)
if [ -d "$npm_path" ] && echo $PATH | grep -qv "$npm_path"; then
export PATH=$npm_path:$PATH
fi
fi
# Increase memory sizes for java using Ant

View File

@ -31,7 +31,10 @@ end
# NPM paths
if type -q npm
set -gx PATH (npm bin -g 2> /dev/null) $PATH
set npm_path (npm bin -g 2> /dev/null)
if [ -d "$npm_path" ]
set -gx PATH $npm_path $PATH
end
end
# Add rust path