jdx / npm-register

Your own private npm registry and backup server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Ianfeather opened this issue · comments

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?

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

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

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

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

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.

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

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

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

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

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

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

Could you publish 2.6.1 when you get a chance?

@Ianfeather published, can you try again?

Will do

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.

@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.