LinuxCommandLibrary

npm

Manage JavaScript packages

TLDR

Create a package.json file with default values (omit --yes to do it interactively)

$ npm init [[-y|--yes]]
copy

Download all the packages listed as dependencies in package.json
$ npm [[i|install]]
copy

Download a specific version of a package and add it to the list of dependencies in package.json
$ npm [[i|install]] [package_name]@[version]
copy

Download the latest version of a package and add it to the list of dev dependencies in package.json
$ npm [[i|install]] [package_name] [[-D|--save-dev]]
copy

Download the latest version of a package and install it globally
$ npm [[i|install]] [package_name] [[-g|--global]]
copy

Uninstall a package and remove it from the list of dependencies in package.json
$ npm [[r|uninstall]] [package_name]
copy

List all locally installed dependencies
$ npm [[ls|list]]
copy

List all top-level globally installed packages
$ npm [[ls|list]] [[-g|--global]] --depth [0]
copy

SYNOPSIS

npm [options]

PARAMETERS

init
    Create package.json interactively

install [pkg]
    Install packages

uninstall
    Remove package

update [pkg]
    Update packages

run