npm Community Forum (Archive)

The npm community forum has been discontinued.

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

[INVALID] NPM scripts do not detect node_modules executables in Windows PowerShell and CMD

What I Wanted to Do

Run npm run dev in my project. In Linux and macOS, it works fine.

What Happened Instead

Any commands in NPM package.json scripts fail, f.e. if a script is

"dev": "builder run build:dev",

then it fails in Windows PowerShell or CMD, and NPM says something like

PS C:\Users\trusktr> npm run dev

> infamous@21.0.6 dev C:\Users\trusktr\src\trusktr+infamous
> builder run build:dev

'builder' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! errno 1
npm ERR! infamous@21.0.6 dev: `builder run build:dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the infamous@21.0.6 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\trusktr\AppData\Roaming\npm-cache\_logs\2019-02-18T05_11_32_783Z-debug.log

But .\node_modules\.bin\builder does exist.

Reproduction Steps

In Windows PowerShell (make sure you have git and node installed, and SSH setup first):

git clone
cd .\infamous\
npm install
npm run dev

Then I get 'builder' is not recognized as an internal or external command


Just trying to dev like I normally do in Linux or macOS, but it seems NPM isn’t setting executables to the temporary process PATH from .\node_modules\.bin or something.

Platform Info

$ npm --versions
PS C:\Users\trusktr\src\trusktr+infamous> npm --versions
{ infamous: '21.0.6',
  npm: '6.7.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '34.0',
  http_parser: '2.8.0',
  icu: '63.1',
  llhttp: '1.1.1',
  modules: '67',
  napi: '4',
  nghttp2: '1.34.0',
  node: '11.10.0',
  openssl: '1.1.1a',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.26.0',
  v8: '',
  zlib: '1.2.11' }
$ node -p process.platform

Nevermind, looks like the npm scripts work, and it is the builder command failing when it tries to run another command. So it’s a problem with builder.

Maybe because builder isn’t listed as a dep in builder-js-package?