TarikHuber / rmw-shell

Shell of main components for the React Most Wanted project
26 stars 23 forks source link

node\r: No such file or directory #20

Closed RobertSasak closed 5 years ago

RobertSasak commented 5 years ago

I get a following error when running start. I found similar issue which is related to UTF encoding. https://github.com/darkguy2008/parallelshell/issues/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 commented 5 years ago

Hi @RobertSasak ,

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

RobertSasak commented 5 years ago

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

TarikHuber commented 5 years ago

Yes. I'm working on windows. I think someone else had a similar issue. I think it's the same cause: https://github.com/TarikHuber/react-most-wanted/issues/38

RobertSasak commented 5 years ago

I found the problem. It is related to https://github.com/npm/npm/issues/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".