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 https://gist.github.com/yaram/5f21cfe33ab76ed32767f307c3bc87cc

Details

I have created a test repository at https://github.com/yaram/npm-git-dependency 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 https://github.com/npm/npm/issues/19564.

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: '6.8.275.32-node.36',
  zlib: '1.2.11' }
$ node -p process.platform
win32

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.