Node.js basics

When installing a package that will be bundled into your production bundle, you should use npm install --save. If you’re installing a package for development purposes (e.g. a linter, testing libraries, etc.) then you should use npm install --save-dev.

Custom NPM scripts must be preceded by either run-script or run for them to be executed correctly.

Get a list of globally installed packages

npm list -g --depth 0

Remove unused packages from project (no longer in package.json)

npm prune

Check outdated packages

npm outdated

Force update of major version

npm install <package>@latest

Bundling node modules for usage in a browser


Compiling a node.js script to a standalone application