npm Community Forum (Archive)

The npm community forum has been discontinued.

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

`npm config edit` reformats file, stripping user comments

What I Wanted to Do

Use npm config edit and see my semi-colon prefaced comments remain after opening.

What Happened Instead

The uncommented portions were preserved but the commented portions were not.

Reproduction Steps

  1. Add a semi-colon prefaced comment line at the top of one’s .npmrc file.
  2. Watch it be stripped upon running npm config edit


Platform Info

$ npm --versions

{ npm: '6.11.3',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.33.0',
  node: '10.11.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.0',
  v8: '',
  zlib: '1.2.11' }

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

Previously reported here: npm commit strips out comments