W3cubDocs

/Ansible

npm - Manage node.js packages with npm

Synopsis

Manage node.js packages with Node Package Manager (npm)

Options

parameter required default choices comments
executable
no
The executable location for npm.
This is useful if you are using a version manager, such as nvm
global
no
  • yes
  • no
Install the node.js library globally
ignore_scripts
(added in 1.8)
no
  • yes
  • no
Use the --ignore-scripts flag when installing.
name
no
The name of a node.js library to install
path
no
The base path where to install the node.js libraries
production
no
  • yes
  • no
Install dependencies in production mode, excluding devDependencies
registry
(added in 1.6)
no
The registry to install modules from.
state
no present
  • present
  • absent
  • latest
The state of the node.js library
version
no
The version to be installed

Examples

description: Install "coffee-script" node.js package.
- npm: name=coffee-script path=/app/location

description: Install "coffee-script" node.js package on version 1.6.1.
- npm: name=coffee-script version=1.6.1 path=/app/location

description: Install "coffee-script" node.js package globally.
- npm: name=coffee-script global=yes

description: Remove the globally package "coffee-script".
- npm: name=coffee-script global=yes state=absent

description: Install "coffee-script" node.js package from custom registry.
- npm: name=coffee-script registry=http://registry.mysite.com

description: Install packages based on package.json.
- npm: path=/app/location

description: Update packages based on package.json to their latest version.
- npm: path=/app/location state=latest

description: Install packages based on package.json using the npm installed with nvm v0.10.1.
- npm: path=/app/location executable=/opt/nvm/v0.10.1/bin/npm state=present

This is an Extras Module

For more information on what this means please read Extras Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/npm_module.html