Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Can't run deskgap on Linux because of line endings #33

Closed
matt-allan opened this issue Jul 5, 2019 · 3 comments
Closed

Can't run deskgap on Linux because of line endings #33

matt-allan opened this issue Jul 5, 2019 · 3 comments

Comments

@matt-allan
Copy link

matt-allan commented Jul 5, 2019

Hello,

I was following the guide in the README on Ubuntu Linux 19.04. When I tried to run yarn start I encountered the following error:

$ yarn start
yarn run v1.16.0
warning package.json: No license field
$ deskgap .
/usr/bin/env: ‘node\r’: No such file or directory
error Command failed with exit code 127.

If I execute /usr/bin/env node directly it works as expected:

$ /usr/bin/env node
Welcome to Node.js v12.4.0.
Type ".help" for more information.
> 

Eventually I was able to resolve the issue by running dos2unix on the cli.js file:

$ dos2unix ./node_modules/deskgap/cli.js
dos2unix: converting file ./node_modules/deskgap/cli.js to Unix format...

The file command shows that cli.js (and it looks like the rest of the files too) has CRLF line terminators:

$ file ./node_modules/deskgap/cli.js    
./node_modules/deskgap/cli.js: a /usr/bin/env node script, ASCII text executable, with CRLF line terminators
@rezaxdi
Copy link

rezaxdi commented Jul 7, 2019

I can confirm this problem with ubuntu 18.04 and node v8.10

@matt-allan
Copy link
Author

I've been reading up on this and it sounds like if you check the project out with git the line endings should be fixed automatically.

The problem seems to happen when you check the project out on a windows computer, then publish to NPM, as explained in this NPM issue.

I think we might be able to set npm/cli.js text eol=lf in a .gitattributes file to prevent this from happening? It would ensure that the line endings are always converted to LF on checkout, even on Windows. We would then need to publish a new package. I don't have a Windows machine to test this on and confirm it doesn't break anything though.

@remorses
Copy link

remorses commented Dec 3, 2019

Same on Mac os with version 0.1.0

branchseer added a commit that referenced this issue Mar 13, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants