salt.modules.npm

Manage and query NPM packages.

salt.modules.npm.install(pkg=None, dir=None, runas=None)

Install an NPM package.

If no directory is specified, the package will be installed globally. If no package is specified, the dependencies (from package.json) of the package in the given directory will be installed.

pkg
A package name in any format accepted by NPM
dir
The target directory in which to install the package, or None for global installation
runas
The user to run NPM with

CLI Example:

salt '*' npm.install coffee-script
salt.modules.npm.list_(pkg=None, dir=None)

List installed NPM packages.

If no directory is specified, this will return the list of globally- installed packages.

pkg
Limit package listing by name
dir
The directory whose packages will be listed, or None for global installation

CLI Example:

salt '*' npm.list
salt.modules.npm.uninstall(pkg, dir=None, runas=None)

Uninstall an NPM package.

If no directory is specified, the package will be uninstalled globally.

pkg
A package name in any format accepted by NPM
dir
The target directory from which to uninstall the package, or None for global installation
runas
The user to run NPM with

CLI Example:

salt '*' npm.uninstall coffee-script