Why? So that you can check your node_modules folder into git, whether or not there are mixed line endings in files.

Use dos2unix, which you can get using macports:

sudo port install dos2unix

And then use it:

dos2unix filetoconvert.js

Or if there are many offending files:

find path/to/bad/files/ | xargs dos2unix

And then git add whatever you like and you'll be good to go!


Feb 23 2012, 10:59 PM

Walter Blaurock responded

How about the core.autocrlf setting in git? http://help.github.com/line-endings/

Feb 28 2012, 5:53 PM

David Trejo responded:

@walter: Hey, you're totally right.

The main issue is that if you try to git add a bunch of files at the same time, even with that setting set correctly, it will complain about mixed line endings and prevent your from adding those files.

This generally only happens when you try to git add files that are built or auto-generated, or that someone else wrote on a windows computer AND a linux machine, leading to mixing.