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

node\r: No such file or directory #20

Closed
RobertSasak opened this issue Nov 23, 2018 · 4 comments
Closed

node\r: No such file or directory #20

RobertSasak opened this issue Nov 23, 2018 · 4 comments

Comments

@RobertSasak
Copy link

I get a following error when running start. I found similar issue which is related to UTF encoding. darkguy2008/parallelshell#58

$ npm start

> testProject@0.1.0 start /Users/robert/Documents/GitLab/testProject
> react-scripts start

env: node\r: No such file or directory
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! testProject@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the testProject@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/admin/.npm/_logs/2018-11-23T09_29_25_992Z-debug.log

App starts when I install react-scripts as a global package and run it from console.

yarn global add react-scripts
react-scripts start
@TarikHuber
Copy link
Owner

Hi @RobertSasak ,

Do you have the same issue with the original Create React App project?

@RobertSasak
Copy link
Author

No, I can run $ npx create-react-app test-app without any problem. Are you by any chance working on Windows?

@TarikHuber
Copy link
Owner

Yes. I'm working on windows. I think someone else had a similar issue. I think it's the same cause: ecronix/react-most-wanted#38

@RobertSasak
Copy link
Author

I found the problem. It is related to npm/npm#12371 .

I fixed it by opening node_modules/rmw-react-scripts/bin/react-scripts.js in VS Code and clicked in the bottom toolbar on CRLF and switch it to LF.

After this change I was able to run yarn start.

It has something to do with how the first line is ended.

#!/usr/bin/env node

On MacOS return \r is consired as a part of program name "node\r".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants