A package.json install that works.

It's an ugly hack, but it works.
This commit is contained in:
isaacs
2010-11-25 01:42:24 -08:00
parent c657328c8d
commit b82bcfbd47
3 changed files with 49 additions and 1 deletions

24
install.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
dir=$npm_config_root/.npm/$npm_package_name/$npm_package_version/package
# add lines to the bashrc.
has=$(cat ~/.bashrc | egrep "^# ADDED BY npm FOR NVM$" || true)
if [ "x$has" != "x" ]; then
exit 0
fi
cat <<NVM_CODE >>~/.bashrc
# ADDED BY npm FOR NVM
NVM_DIR=$dir
. \$NVM_DIR/nvm.sh
nvm use
# END ADDED BY npm FOR NVM
NVM_CODE
cat <<NVM_HOWTO
To use nvm, source your .bashrc file like this:
. ~/.bashrc
or log out and back into your terminal.
NVM_HOWTO