npm Community Forum (Archive)

The npm community forum has been discontinued.

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

junction/symlink becomes file by `npm config edit` on Windows

What Happened

Windows’ junction/symlink folder becomes a file :scream:
by npm config edit
when userconfig value is empty in .npmrc

Reproduction Steps

  1. set userconfig= in .npmrc
    (I believe it’s a wrong setting, but still possible)
  2. make a junction or symlink of the folder
  3. run npm config edit in the link-folder
  4. the folder becomes a file
    (becomes a .npmrc file without renaming)

here is the commands

: in cmd.exe
mkdir a
cd a
echo userconfig= > .npmrc

cd ..
mklink /J b a
cd b
npm config edit
: now juction b become file b!

Platform Info

$ npm --versions
<!-- paste output here -->
{ npm: '6.7.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.15.0',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '',
  zlib: '1.2.11' }

$ node -p process.platform
<!-- paste output here -->