Skip to content
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

/usr/bin/env: ‘node\r’: No such file or directory #101

Closed
Ianfeather opened this issue Jan 10, 2018 · 15 comments · Fixed by #102 or #103
Closed

/usr/bin/env: ‘node\r’: No such file or directory #101

Ianfeather opened this issue Jan 10, 2018 · 15 comments · Fixed by #102 or #103

Comments

@Ianfeather
Copy link
Contributor

Hey @dgautsch, did you just publish 2.6.0 from a windows machine?

bin/npm-register has been re-encoded with \r for line returns and this is causing the error above. There are similar issues across many projects so it seems to be fairly common, and fixed by specifying encoding:

abrjagad/npm-module-stats#1
nwutils/nw-builder#105

I was able to verify the fix by opening the file and setting line endings to unix :set ff=unix.

I also verified that 2.5.5 worked fine.

Quite a strange bug given that file hasn't changed but perhaps you reopened it before publishing 2.6.0?

@jdx
Copy link
Owner

jdx commented Jan 10, 2018

I bet we should probably add a .gitattributes file but I'm not that familiar with how those need to be written

@Ianfeather
Copy link
Contributor Author

Is that respected by npm too? The encoding in the file checked in to git is still unix based from what I see.

I can take a quick look into gitattributes

@jdx
Copy link
Owner

jdx commented Jan 10, 2018

good point, you're probably right. I don't understand why npm isn't just copying the file wholesale I suppose

@Ianfeather
Copy link
Contributor Author

Ianfeather commented Jan 10, 2018

Yeah I can only guess that the file was open in an editor before publishing and it published an unstaged change? Very peculiar though - i've never seen this before. It looks like we could normalize it with an editorconfig:

root = true

[*]
charset = utf-8
end_of_line = lf

@Ianfeather
Copy link
Contributor Author

I can make a PR to add this if you like. It might require resaving any/all files.

fwiw when I did change the line endings using :set ff=unix git recognised that the file had changed.

@jdx
Copy link
Owner

jdx commented Jan 10, 2018

editorconfig is a good thing and I put it in a lot of projects, but most editors don't look at it by default

@jdx
Copy link
Owner

jdx commented Jan 10, 2018

we should also add a gitattributes file, one of those tickets you posted said that fixed their issue

@Ianfeather
Copy link
Contributor Author

ok, I can do this. Give me a few mins and I'll make a PR

@dgautsch
Copy link
Collaborator

Ah! Sorry everyone. I don't even open up the code in my editor in my machine. I cloned, then published. Sorry for this...

@dgautsch
Copy link
Collaborator

I'll check my git settings...I thought I told it to respect line endings and such.

@Ianfeather
Copy link
Contributor Author

No worries @dgautsch, I don't think it's your fault. Pretty unexpected.

Could you publish 2.6.1 when you get a chance?

@dgautsch
Copy link
Collaborator

@Ianfeather published, can you try again?

@Ianfeather
Copy link
Contributor Author

Will do

@Ianfeather
Copy link
Contributor Author

Ianfeather commented Jan 11, 2018

Sorry for the delay. GH went down and I got distracted.

Same issue with 2.6.1 :( I can resolve it in the same way manually too.

Are you able to reproduce this locally? I can reproduce this by npm installing to a fresh directory and running npm start.

@dgautsch dgautsch reopened this Jan 11, 2018
@dgautsch
Copy link
Collaborator

@Ianfeather I know this won't run on windows because I had to fix it in my UI feature branch. So i'm not sure I can reproduce on my machine. This path ./bin/npm-register start won't work on a Windows box. I suggest we rewrite the start script to node bin/npm-register start That should work on all platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants