-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Line endings break cli.js on Unix Machines #15
Comments
So a little story: I HATE THIS LINE ENDING BUSINESS Rant over, sorry about that. I am mainly a windows guy, so correct me if I am wrong - Currently the only way to avoid this issue is by publishing from a linux machine? |
I agree, it would be nice if npm's 'publish' command just took care of it in a cross-platform way. But! I have an idea. There is a module called crlf that will convert I just smoke-tested it and it appears to work fine. If you create a {
"scripts": {
"prepublish": "crlf --set=LF cli.js"
}
} Or do it manually. Or something else similar that uses that |
In theory a |
Note - right now you have |
You can also change most text editors to have Unix style (linefeed only) line endings like OSX and all Linux flavors use. |
updating gitattributes to prefer unix-style line endings (should fix #15)
I merged the fix for the |
ok, I've pushed |
Works! Thank you @M-Zuber |
Yup, works great now. the prepublish hook makes sense - can't hurt to make sure |
Thank you both for the help in diagnosing |
After I upgraded a project to npm-watch@0.1.2, it was blowing up on me with the following error:
So I cloned this repo, did a
npm link
and it worked fine, giving me the suspicion that this was a line ending issue.I then installed
npm-watch
in a local project, it failed with the same issue. After running the following one-liner to clobber the Windows line-endings:sed 's/\r$//' -i node_modules/npm-watch/cli.js
It worked fine again. This puzzled me because all I saw in the git history was the removal of that
console.log()
.I did a little research, and this is an open issue with npm and cross-platform compatibility: npm/npm#2097
So if you published from a Windows machine,
npm publish
sends the\r\n
, but thengit commit
is converting the line endings and commiting\n
, so you never see it in the repo.The text was updated successfully, but these errors were encountered: