npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Git dependencies that use CLI tools specified in devDependencies cannot use them in prepack scripts

What I Wanted to Do

Use a git dependency that has a CLI tool in it’s devDependencies that is used in the package’s prepack script.

What Happened Instead

The prepack script is run before dependencies are installed, resulting in the CLI tool not being found.

Reproduction Steps

  1. Run npm install with the package.json specified here


I have created a test repository at containing a basic package using a CLI tool specified in devDependencies (in this case rimraf) in the prepack script. The package in the gist includes this package as a git dependency in it’s dependencies.

This bug was also posted under the legacy issue at

Platform Info

$ npm --versions
{ npm: '6.4.1',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.14.1',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '',
  zlib: '1.2.11' }
$ node -p process.platform