FANDOM


nodejs Edit

Reding Book Edit

  • Node.js Recipes - Cory Gackenheimer

npm Edit

  • update npm version
>sudo npm update -g npm

npm initEdit

  • use npm init wizard for generate package.json
>mkdir node_test
>npm init

nvm Edit

install nvm Edit

  • manual install
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
    • you need to source it from your shell, I always add this line to my ~/.bashrc
 . ~/.nvm/nvm.sh
  • shell install
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash

sudo nvm Edit

  • For CentOS 6
  • add nvm.sh to current user .bashrc
vi ~/.bashrc
## add below
. /home/appdev/.nvm/nvm.sh
  • add nvm.sh to root .basrc
vi /root/.bashrc
## add below
. /home/appdev/.nvm/nvm.sh
  • sudo visudo
## add
Defaults    secure_path = + /usr/local/nodejs/nodejs/bin:/usr/local/bin
  • edit current user ~/.bash_profile
vi ~/.bash_profile
#add
PATH=$PATH:/usr/local/nodejs/nodejs/bin:$HOME/bin
alias sudo='sudo env PATH=$PATH:$NVM_BIN'

nvm help Edit

  • nvm usage
nvm help

nvm list-remote , nvm listEdit

  • list all node version available for download
nvm ls-remote
  • list local version
nvm ls

= nvm common command Edit

  • install version
nvm install 4.1.0
nvm uninstall 4.1.0
nvm alias dev 4.1.0
nvm unalias dev
nvm run 4.1.0 app.js
nvm run dev app.js
nvm use 4.1.0

nvm default alias Edit

nvm alias default 0.12.7

nave , n Edit

  • nave is another node version management tool
>npm install -g nave
  • n is another node version management
>npm install -g n

package.json Edit