Skip to content

Web

Javascript

Node.js

Install

Simply download the Installer direct from the nodejs.org web site.

bash (macOS)

curl "https://nodejs.org/dist/latest/node-${VERSION:-$(wget -qO- https://nodejs.org/dist/latest/ | sed -nE 's|.*>node-(.*)\.pkg</a>.*|\1|p')}.pkg" > "$HOME/Downloads/node-latest.pkg" && sudo installer -store -pkg "$HOME/Downloads/node-latest.pkg" -target "/"

nvm

https://github.com/nvm-sh/nvm

brew install nvm

Add the source line to your profile: (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc)

export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
  • List available versions using ls-remote
nvm ls-remote
  • Download, compile, and install the latest release of node
nvm install node # "node" is an alias for the latest version
  • Install a specific version of node
nvm install 6 # or 10, 8, etc
  • Use the installed version
nvm use node

homebrew

brew install node

NPM

npm install <package>

On Unix systems they are normally placed in /usr/local/lib/node or /usr/local/lib/node_modules when installed globally. If you set the NODE_PATH environment variable to this path, the modules can be found by node.

  • List all global packages and show where they're located
npm list -g --depth=0
  • Update global package
npm update -g <package>
  • Find out which package need to be updated
npm outdated -g --depth=0
  • Update all global packages
npm update -g

npm-check

https://www.npmjs.com/package/npm-check

  • Install
npm install -g npm-check
  • Use
npm-check