npm Community Forum (Archive)

The npm community forum has been discontinued.

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

npm fails to update itself when run from extracted node archive distribution on windows

Still applies to the latest node (11.12)

What I Wanted to Do

npm included with node in its official archive distributions (zip 7z) should be able to update itself

What Happened Instead

update fails

npm ERR! path C:\tmp\node-v11.12.0-win-x64\npm.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete C:\tmp\node-v11.12.0-win-x64\npm.cmd: is outside C:\tmp\node-v11.12.0-win-x64\node_modules\npm and not a link
npm ERR! File exists: C:\tmp\node-v11.12.0-win-x64\npm.cmd
npm ERR! Move it away, and try again.

Reproduction Steps

  1. download and extract the latest node archive
  2. run npm update -g npm form the extracted folder

Details

Platform Info

$ npm --versions

{ 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.12.0',
  openssl: '1.1.1b',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.26.0',
  v8: '7.0.276.38-node.18',
  zlib: '1.2.11' }

$ node -p process.platform

win32