Daniel Reina
Daniel Reina

Reputation: 6327

npm package.json formatted in one line

I have this issue, and whenever I do npm init the file package.json is created, but it is formatted in one line. As you can imagine this is not practical to work with and I end up formatting it myself, which is not the best task in the world.

EDIT
I have noticed that when I do npm install the file gets reformatted again to one line. This is very annoying and I'm sure it must be some configuration that I cannot find.

What should I change to have the file formatted from the beginning?

Thanks!

Upvotes: 1

Views: 1369

Answers (1)

Andreas Jägle
Andreas Jägle

Reputation: 12240

When npm creates and updates the files, it rewrites the line endings to unix-style LF whereas windows endings are CRLF. When using an editor that doesn't handle unix endings correctly, you will see the whole content in one line.

So: use an editor that can handle unix line endings correctly.

Upvotes: 2

Related Questions