npm Community Forum (Archive)

The npm community forum has been discontinued.

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

npm still mangles line endings

What I Wanted to Do

npm run

What Happened Instead

npm mangled line endings in package.json

Reproduction Steps

npm run on a windows machine


Platform Info


$ npm --versions
5.7, 5.10, 6.2 (all showing the issue)
$ node -p process.platform
<!-- paste output here -->

Please fill in more details than this. npm run does not itself write package.json, so I don’t know what you were actually doing. If you don’t add proper reproduction steps, I’ll be moving this to #support.

Triage notes: this is a useless bug report and I suspect it’s PEBKAC if it’s anywhere close to what OP is saying.

It does write to package.json. I was upgrading npm to get the fix for the LF. However, turns out this was related to npm adding a single terminal line ending (not every line). Once that was committed it is finally not thrashing.

If you’re getting a modified package.json after npm run <>, this must be due to a run-script, which is not part of npm itself. Like I said, I’ll need a more specific reproduction, but it sounds like this is a support issue now, so I’m moving it accordingly.