npm package.json formatted in one line

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-17 04:41:13

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/38953302/npm-package-json-formatted-in-one-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!