Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

node.js

nvm └── manages Node.js versions └── each Node.js installation includes npm └── npm manages project packages

Install & Update

Follow instructions on: https://nodejs.org/en/download

Installed Node versions and the active/default version

nvm ls

# Globally installed npm packages for the active Node version
npm list -g --depth=0

# Dependencies installed in the current project
npm list --depth=0

# Check what has updates available
npm outdated -g
npm outdated

Global npm packages are separate for each NVM-managed Node version.

Update Node while staying on LTS

This installs the newest LTS version and carries over your global packages:

nvm install --reinstall-packages-from=current 'lts/*'
nvm alias default 'lts/*'
nvm use 'lts/*'

# Verify afterward:
node --version
npm --version
nvm current

If you also want the newest npm version compatible with your active Node:

nvm install-latest-npm

npm itself doesn’t have an “LTS” channel; Node does.

Update npm packages

# Global packages:
npm outdated -g
npm update -g

# Inside an individual project:
npm outdated
npm update

npm update respects the version ranges in that project’s package.json. Major-version upgrades generally require an explicit install or a tool such as npm-check-updates.

Update NVM itself

https://github.com/nvm-sh/nvm#install--update-script