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

Line ending error #7

Closed
rosszurowski opened this issue Oct 17, 2019 · 4 comments · Fixed by #10
Closed

Line ending error #7

rosszurowski opened this issue Oct 17, 2019 · 4 comments · Fixed by #10

Comments

@rosszurowski
Copy link

rosszurowski commented Oct 17, 2019

Hi! Immediately after installing contentful-hugo v1.3.8 I ran into the following error:

$ contentful-hugo
env: ‘node\r’: No such file or directory
error Command failed with exit code 127.

I've gotten this error both locally and on a Netlify build server.

Looking deeper, it seems the cli.js file has a CRLF line ending, rather than just an LF ending, which is causing bash to misinterpret #!/usr/bin/env node as #!/usr/bin/env node\r. Fixing this line ending resolved the error.

@joshmossas
Copy link
Member

Hi @rosszurowski. I just want to confirm. Is this issue still happening for you in the latest version? (v1.3.10)

I work on work on Windows so I can't test as far as your machine goes, but it does work successfully on a Netlify build server for me.

Thanks!

@rosszurowski
Copy link
Author

rosszurowski commented Oct 28, 2019

The issue is still happening on v1.3.10, though installing via npm instead of yarn seems to have resolved it. This would also explain why it fails on my Netlify builds, because those are using yarn too.

Seems like this might actually be an issue for how yarn handles line endings instead.

@joshmossas
Copy link
Member

@rosszurowski huh that's really interesting. When I get some time I'll look into this further and see if I can get it working on both Yarn and NPM installations.

@Matt-Jensen
Copy link
Contributor

Matt-Jensen commented Nov 12, 2019

Experiencing this bug on Linux and MacOS. If it's helpful I was able fix this bug on MacOS by:

brew install dos2unix
find ./node_modules/contentful-hugo -name "*.js" | xargs sudo dos2unix

AFAIK this fixed the issue because it rewrote the line separator characters committed to be compatible with the host OS. The index.js file may have line endings in CRLF (windows) instead of LS (unix). You may be able to fix this with your Git settings, but can't confirm that.

Matt-Jensen added a commit to Matt-Jensen/contentful-hugo that referenced this issue Nov 12, 2019
joshmossas added a commit that referenced this issue Nov 14, 2019
joshmossas pushed a commit that referenced this issue Sep 14, 2020
joshmossas added a commit that referenced this issue Sep 14, 2020
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.

3 participants