nvm, yarn cheatsheet

by Giang, last updated 14 Dec 2018

nvm

nvm is a node version manager software. It manages nvm and iojs versions and run on Mac & Linux.

Github repo: https://github.com/creationix/nvm

Installation

# Install
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

# Verify installation, should return 'nvm'
command -v nvm

Commands

# Install latest node version
nvm install node
# Install specific version
nvm install 8.11

# Uninstall a version
nvm uninstall 8.11

# Locate the path to an installed version
nvm which 8.11
# /Users/demo/.nvm/versions/node/v8.11.4/bin/node

# Current node version in use
nvm current

# Use latest version
nvm use node
# Use specific version
nvm use 8.11

# List installed versions
nvm ls

# List available versions of Node and iojs
nvm ls-remote
# Only list version 8
nvm ls-remote | grep v8
# Only list LTS versions
nvm ls-remote --lts
# Only list specific LTS line versions
nvm ls-remote --lts=Carbon

# Run a command using a specific node version
nvm run 8.11 --version

Yarn

Yarn is a Nodejs packages management created by Facebook.

Home page: https://yarnpkg.com/en/
Github repo: https://github.com/yarnpkg/yarn/

Yarn is simple to use and have a nice documentation on installation and usage at: