Reding Book

  • Node.js Recipes - Cory Gackenheimer


  • update npm version
>sudo npm update -g npm

npm init

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


install nvm

  • manual install
git clone ~/.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/
  • shell install
curl -o- | bash
wget -qO- | bash

sudo nvm

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

nvm help

  • nvm usage
nvm help

nvm list-remote , nvm list

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

= nvm common command

  • 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

nvm alias default 0.12.7


Community content is available under CC-BY-SA unless otherwise noted.