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

env: node\r: No such file or directory #1431

Closed
gabrielrtakeda opened this issue Sep 17, 2020 · 13 comments
Closed

env: node\r: No such file or directory #1431

gabrielrtakeda opened this issue Sep 17, 2020 · 13 comments

Comments

@gabrielrtakeda
Copy link

Do you want to request a feature or report a bug?

a bug.

What is the current behaviour?

When I run preact build in version 3.0.2 I'm receiving the error below:

env: node\r: No such file or directory

If the current behaviour is a bug, please provide the steps to reproduce.

  1. yarn add [email protected]
  2. yarn preact build
preact.config.js

https://gist.github.com/gabrielrtakeda/d9a2f75d91d5eb302295eb51eff8d104

What is the expected behaviour?

To build properly.

If this is a feature request, what is motivation or use case for changing the behaviour?

Please mention other relevant information.

Please paste the results of preact info here.

preact info in 3.0.2 also gives this error. Follow below the preact info using 3.0.1

Environment Info:
  System:
    OS: macOS 10.15.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 14.11.0 - /var/folders/40/hmnm06wd6dv_q5pklkjdh5dc0000gn/T/yarn--1600377853618-0.2735555090153792/node
    Yarn: 1.22.5 - /var/folders/40/hmnm06wd6dv_q5pklkjdh5dc0000gn/T/yarn--1600377853618-0.2735555090153792/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v14.11.0/bin/npm
  Browsers:
    Chrome: 85.0.4183.102
    Firefox: 77.0.1
    Safari: 13.1.2
  npmPackages:
    preact: ^10.4.8 => 10.4.8
    preact-cli: ^3.0.1 => 3.0.1
    preact-render-to-string: ^5.1.10 => 5.1.10
@rschristian
Copy link
Member

rschristian commented Sep 17, 2020

That's due the CRLF line endings on the latest deploy, sorry. It's been noted.

You can downgrade to v3.0.1 ("preact-cli": "3.0.1",) or do something along the lines of the following:

vim node_modules/preact-cli/lib/index.js

:se ff=unix
:wq

@gabrielrtakeda
Copy link
Author

thanks for the quick reply... closing this

@rschristian
Copy link
Member

Don't have any actual power here to reopen this, but can you? It is a valid issue at the moment. Should stay open for visibility.

@JoviDeCroock JoviDeCroock reopened this Sep 17, 2020
@tuzmusic
Copy link

I'm getting the same error, and I'm on 3.0.1. preact build from command line works. yarn build gives the error.

In package.json:

  "scripts": {
    "build": "preact build",
    "serve": "sirv build --port 8080 --cors --single",
    "dev": "preact watch",
    "lint": "eslint src"
  },

@rschristian
Copy link
Member

rschristian commented Sep 19, 2020

@tuzmusic

Are you able to provide a repo? I'm willing to bet that you're not actually on 3.0.1, but 3.0.2. If you aren't aware, the symbols in a version number in you package.json decide which version upgrades you're okay with. ^ means you're fine with any changes to the patch version number, so 3.0.2 would fulfill ^3.0.0 or ^3.0.1. That's likely your issue.

Secondly, using preact build indicates you have the CLI globally installed, which is something we now recommend against. It's too easy for this to fall out of date and isn't really required. Instead we recommend using npx when you want to create new projects.

@sibelius
Copy link

same here, what is the fix?

@peterbe
Copy link

peterbe commented Sep 29, 2020

same here, what is the fix?

There is no fix :(
We have to wait for a 3.0.3 release.
If you correct the file (I used prettier --write) it'll just revert as soon as you do yarn install the next time.

@JohnnyCrazy
Copy link

Some investigation for this problem:

  • If you do a fresh install of preact-cli (version 3.0.2), all JS files will have windows CR LF line endings. This breaks the cli linux installations, since in /packages/cli/lib/index.js the following line can't be read by env:
#!/usr/bin/env node\r
  • The line endings in the source repository are correct LF endings, so not the culprit. (This can be confirmed by running file /packages/cli/lib/index.js:

Output from cloned git repo:

projects/preact-cli/packages/cli/lib/index.js: Node.js script, ASCII text executable

Output from downloaded npm zip:

index.js: Node.js script, ASCII text executable, with CRLF line terminators

Since I didn't find a automated CI/CD pipeline my guess would be: Someone, who is running windows, published manually and had core.autocrlf true set in his git config. This means the source repository was checked out with CRLF although they are LF

@rschristian
Copy link
Member

Yes, this was a problem specifically with the deploy. The editor config seemingly did not catch this.

@JohnnyCrazy
Copy link

@rschristian 👍

Can we expect a hotfix in the near future?

@rschristian
Copy link
Member

As of now I haven't heard anything. Until then downgrade to 3.0.1 or you can fix with the method I mentioned above.

I'll bring it back up.

@rschristian
Copy link
Member

Fix should be coming right up

@prateekbh
Copy link
Member

published 3.0.3

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

No branches or pull requests

8 participants