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] Error when attempting to create a project with Yarn on WSL #36

Closed
lewdum opened this issue Nov 15, 2022 · 7 comments
Closed

[BUG] Error when attempting to create a project with Yarn on WSL #36

lewdum opened this issue Nov 15, 2022 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@lewdum
Copy link

lewdum commented Nov 15, 2022

Describe the bug
Hi. On Linux (or at least WSL 2), attempting to run yarn create narrat results in this error:

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

This is apparently because the create-narrat script has CRLF line endings. Changing them to just LF allows project creation to proceed as normal.

To Reproduce
Steps to reproduce the behavior:

  1. Simply run yarn create narrat on WSL (and possibly other Linux environments)

Screenshots
error message

Thanks!

@lewdum lewdum added the bug Something isn't working label Nov 15, 2022
@liana-p
Copy link
Owner

liana-p commented Nov 15, 2022

Thanks for letting me know. I don't have WSL installed on windows right now so I've only tested on Mac and Windows. Going to try reinstalling it to check it.

It probably has CRLF in it if I made a release from Windows... maybe just doing another release from my Mac would fix it. I don't really know if there's a way to stop Windows from using CRLF

I'm surprised it makes the script crash though, strange

@liana-p
Copy link
Owner

liana-p commented Nov 15, 2022

Interesting finding: I just tried running yarn create narrat on my Mac and got the same issue, but npm create narrat works fine, which is probably why I never noticed it.

For now I'd advise using npm or pnpm rather than yarn, as I haven't tested anything with yarn, but I'll see if it can be fixed

@lewdum
Copy link
Author

lewdum commented Nov 15, 2022

Thank you! I think git itself replaces line endings by CRLF, as I often get this message when committing:

warning: LF will be replaced by CRLF in _____
The file will have its original line endings in your working directory

You could ask git not to do the conversion, but I agree that yarn shouldn't be having this issue at all in the first place, so maybe it merits further investigation.

@liana-p
Copy link
Owner

liana-p commented Nov 15, 2022

I think git itself replaces line endings by CRLF

Yes, it auto changes to LF before committing to avoid issues with Unix systems which is correct, what breaks is having the CRLF from Windows. But since I did the release from a Windows PC, it still had the windows line endings because the conversion would only happen for committing.

there's a bug in yarn about this which seems to have never been fixed. npm apparently sneakily fixes line endings for you behind the scenes, while yarn doesn't.

Seems a solution is to just add config files for the IDE to save files with LF instead of the default CRLF, so I'll try to set that up.

@lewdum
Copy link
Author

lewdum commented Nov 15, 2022

Oh, I see what you mean now. For what's worth, other than this issue, Yarn has been working great out of the box. I was able to install dependencies and start the development server 👍

@liana-p
Copy link
Owner

liana-p commented Nov 16, 2022

I've released a new version of create-narrat, seems like it fixes the issue with yarn. Also added more config files to make sure editors on windows use LF

@lewdum
Copy link
Author

lewdum commented Nov 16, 2022

Awesome! Now it creates successfully and even shows the commands at the end with yarn instead of npm, which I think didn't happen before. I'll be closing the issue with this comment, hope that's okay. (Also editing the issue's text to give the image a more permanent URL because I goofed up.)

Screenshot 2022-11-16 153313

@lewdum lewdum closed this as completed Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants