npm_package

May 19, 2026 ยท View on GitHub

Installs or removes an npm package. The legacy nodejs_npm alias is retained.

Actions

ActionDescription
:installInstalls or updates an npm package. Default.
:uninstallUninstalls an npm package if present.
:removeAlias-style remove action for uninstalling an npm package.

Properties

PropertyTypeDefaultDescription
packageStringname propertynpm package name.
versionStringnilnpm package version.
pathStringnilLocal project path. Omit for global installs.
urlStringnilPackage URL or git source.
jsonString, true, falsenilInstall from package.json or a provided JSON/tarball source.
npm_tokenStringnilSensitive NPM token exposed as NPM_TOKEN.
optionsArray[]Extra npm CLI options.
userStringnilUser for the npm command.
groupStringnilGroup for the npm command.
live_streamtrue, falsefalseStreams npm output to the Chef log.
node_envStringnilNODE_ENV value for the npm command.
auto_updatetrue, falsetrueWhen false, skips install if the matching package is already installed.

Examples

npm_package 'express'
npm_package 'async' do
  version '0.6.2'
end
nodejs_npm 'mocha' do
  options ['--production']
end