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

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

Open
christopher-besch opened this issue May 15, 2022 · 12 comments · May be fixed by #404
Open

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

christopher-besch opened this issue May 15, 2022 · 12 comments · May be fixed by #404

Comments

@christopher-besch
Copy link

The file /home/chris/.config/yarn/global/node_modules/live-server/live-server.js seems to be using Windows line endings (\r\n).
Running dos2unix on this file fixes the issue.
I installed live-server with yarn global add live-server and yarn version 1.22.17.

Software details

  • Command line used for launching live-server: live-server
  • OS: Gentoo Base System release 2.7
  • Browser (if browser related):
  • Node.js version: v14.19.0
  • live-server version: 1.2.2

This might be a problem with yarn on Gentoo.
Thanks for your help!

@christopher-besch
Copy link
Author

This problem is related: yarnpkg/yarn#8106

@mattrossman
Copy link

Strangely, the file on GitHub appears to use LF endings, but the one that appears in node_modules installed from the npm Registry uses CRLF. I tried to fork & fix the issue, but I see LF already there in the source. Maybe something weird happened during the latest publish?

So, another workaround is to list the latest version from GitHub as a dependency:

"devDependencies": {
  "live-server": "git+https://github.com/tapio/live-server.git#ad22544",
}

@christopher-besch
Copy link
Author

yarn global add git+https://github.com/tapio/live-server.git#ad22544 fixes the issue.
Thanks a lot, @mattrossman!

@dominicarrojado
Copy link

Happen to me as well, the issue doesn't happen with previous version 1.2.1

@mattrossman
Copy link

@tapio could you please re-publish the latest version without changing the line endings? I was bitten by this again when installing on a new machine.

@uaru
Copy link

uaru commented Sep 6, 2022

yarn global add git+https://github.com/tapio/live-server.git#ad22544 fixes the issue.

For zsh you need quotes.

yarn global add 'git+https://github.com/tapio/live-server.git#ad22544'

@chavinlo
Copy link

for npm package manager:

apt-install dos2unix
dos2unix  /usr/local/lib/node_modules/live-server/*

@kiprasmel
Copy link

1.2.1 is fine, 1.2.2 is broken

@AriPerkkio AriPerkkio linked a pull request Dec 3, 2022 that will close this issue
@AriPerkkio
Copy link

It seems that 1.2.2 was published from a machine using CRLF line endings. Version 1.2.1 indeed works. PR #404 should prevent these in future.

$ grep version node_modules/live-server/package.json
  "version": "1.2.2",
$ file node_modules/.bin/live-server 
node_modules/.bin/live-server: a /usr/bin/env node script text executable, ASCII text, with very long lines (374), with CRLF line terminators

$ grep version node_modules/live-server/package.json
  "version": "1.2.1",
$ file node_modules/.bin/live-server 
node_modules/.bin/live-server: a /usr/bin/env node script text executable, ASCII text, with very long lines (374)

I guess this package is published from local machine instead of CI? That's not good...

@nite
Copy link

nite commented Feb 8, 2023

It seems that 1.2.2 was published from a machine using CRLF line endings. Version 1.2.1 indeed works. PR #404 should prevent these in future.

Should this be merged?

@thescientist13
Copy link

thescientist13 commented Nov 16, 2023

Just ran into this as well. Pinning to 1.2.1 as suggested resolved the issue for me.

@kylebakerio
Copy link

Running into this... was in 1.2.2, also in 1.2.1, but only when using the --port option...? on a linux machine. doesn't seem to be a problem for coworker on his windows machine.

curtisy1 added a commit to curtisy1/xplorer that referenced this issue Apr 13, 2024
live-server 1.2.2 has incorrect line endings, so it breaks Mac and Linux systems.
See tapio/live-server#394 for details
curtisy1 added a commit to curtisy1/xplorer that referenced this issue Apr 14, 2024
live-server 1.2.2 has incorrect line endings, so it breaks Mac and Linux systems.
See tapio/live-server#394 for details
curtisy1 added a commit to curtisy1/xplorer that referenced this issue Apr 14, 2024
live-server 1.2.2 has incorrect line endings, so it breaks Mac and Linux systems.
See tapio/live-server#394 for details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants