Node.js 環境の整備は ndenv で。想定は OS X 環境。
-
nenv
からndenv
に乗り換えました。
CWD=$(pwd)
NDENV="${HOME}/.ndenv"
NDVER='v4.1.1'
if ! which ndenv &> /dev/null
then
if [ ! -d ${NDENV} ]
then
git clone git://github.com/riywo/ndenv.git ${NDENV}
git clone git://github.com/riywo/node-build.git ${NDENV}/plugins/node-build
fi
export PATH="${NDENV}/bin:${PATH}"
eval "$(ndenv init -)"
else
cd ${NDENV}
git pull
cd ${NDENV}/plugins/node-build
git pull
cd ${CWD}
fi
if ! ndenv versions | grep ${NDVER} &> /dev/null
then
ndenv install ${NDVER}
fi
ndenv global ${NDVER}
ndenv rehash
unset NDENV NDVER
if which npm &> /dev/null
then
NPMS=(
'LiveScript'
'coffee-script'
'coffeelint'
'csslint'
'eslint'
'generator-hubot'
'grunt-cli'
'gulp'
'js-yaml'
'jsonlint'
'mocha'
'pulp'
'wzrd'
'yo'
)
for NPM in "${NPMS[@]}"
do
if ! npm list -g | grep ${NPM} &> /dev/null
then
npm install -g ${NPM}
else
npm update -g ${NPM}
fi
done
ndenv rehash
unset NPMS NPM
fi
unset CWD
インストール後 ${HOME}/.bash_profile とかに下記行を追記の事:
export PATH="${HOME}/.ndenv/bin:${PATH}"
eval "$(ndenv init -)"
[ -f "${HOME}/.ndenv/completions/ndenv.bash" ] && source "${HOME}/.ndenv/completions/ndenv.bash"