NPM notes

I forgot that NPM command again… never mind, here is the list.

Uninstall global package

npm uninstall -g webpack

List global packages

npm list -g --depth 0

List available package versions to install

npm view webpack versions --json

Fix security vulnerabilities

npm audit fix
cd my-npm-project-folder
npm link my-npm-project

Test local package if it has unmet dependencies (before publishing)

npm ci

Publish NPM package

npm publish

Set the default Node version in NVM

nvm alias default 18.12.0

Versioning (~=patch; ^=minor)

  • ^5.0.3 => 5.0.[3] gets updated: ^version “Compatible with version” will update you to all future minor/patch versions, without incrementing the major version. For example ^2.3.4 will use releases from 2.3.4 to <3.0.0.
  • ~5.0.3 => 5.[0.3] gets updated: ~version “Approximately equivalent to version” will update you to all future patch versions, without incrementing the minor version. For example ~1.2.3 will use releases from 1.2.3 to <1.3.0.