Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I configure npm to use Windows-style line endings in package.json?

I run Windows, and when npm modifies my package.json file, it writes it using Unix-style line endings (LF). I want it to use Windows-style line endings (CRLF).

Is there a global config setting, or even a command-line option to make npm use the correct EOL characters?

like image 456
Kendall Frey Avatar asked Sep 09 '15 22:09

Kendall Frey


1 Answers

Update: The even easier fix is to use [email protected] or newer.

Assuming Git, the easiest "solution" to this problem is to use a .gitattributes file to specify that package.json (and now package-lock.json) should always use LF:

# .gitattributes in project root
package.json text eol=lf
package-lock.json text eol=lf
like image 113
dahlbyk Avatar answered Sep 23 '22 03:09

dahlbyk