npm Community Forum (Archive)

The npm community forum has been discontinued.

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

npm -v halts batch execution unceremoniously on Windows

What I Wanted to Do

I wanted to have steps after ‘npm -v’ execute in my batch file

What Happened Instead

Batch file execution halted after ‘npm -v’ was done.

Reproduction Steps

echo NPM version:
npm -v
echo This line and any subsequent lines won't be processed!


Errorlevel is 0, no additional messages are output.

Platform Info

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

Windows Server 2016

Short version: try

call npm -v

Longer version

(Moved to #support)

npm uses wrapper batch files to run various of the commands. By default Windows batch files do not return from running another batch file.