live-server
live-server copied to clipboard
Bug: `/usr/bin/env: ‘node\r’: No such file or directory`
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!
This problem is related: https://github.com/yarnpkg/yarn/issues/8106
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",
}
yarn global add git+https://github.com/tapio/live-server.git#ad22544
fixes the issue.
Thanks a lot, @mattrossman!
Happen to me as well, the issue doesn't happen with previous version 1.2.1
@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.
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'
for npm package manager:
apt-install dos2unix
dos2unix /usr/local/lib/node_modules/live-server/*
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...
It seems that
1.2.2
was published from a machine using CRLF line endings. Version1.2.1
indeed works. PR #404 should prevent these in future.
Should this be merged?
Just ran into this as well. Pinning to 1.2.1
as suggested resolved the issue for me.
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.