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

start fails right after create-react-app #10518

Closed
fabiangamboa95 opened this issue Feb 6, 2021 · 39 comments
Closed

start fails right after create-react-app #10518

fabiangamboa95 opened this issue Feb 6, 2021 · 39 comments

Comments

@fabiangamboa95
Copy link

This is the error thrown:
./src/index.js 1:45
Module parse failed: Unexpected token (1:45)
File was processed with these loaders:

  • ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
  • ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
    You may need an additional loader to handle the result of these loaders.
    $RefreshRuntime$ = require('/home/fabian/aws's/reacty-amplified/node_modules/react-refresh/runtime.js');
    | $RefreshSetup$(module.id);
    |

This is the first time i face this issue. Ive been creating react apps with no problems, till about 20 hrs I faced this issue
Im currently on Ubuntu 20.04.2 LTS; node:14.15.4, npm 6.14.10

@HakamMssarwe
Copy link

same problem, started facing it today

@nvh95
Copy link
Contributor

nvh95 commented Feb 6, 2021

There is workaround by using older version of create-react-app by running

npx create-react-app@4.0.1 my-app

@fabiangamboa95
Copy link
Author

fabiangamboa95 commented Feb 7, 2021

ye. the point is to solve the problem. thanks for comments

@gabriel-tama
Copy link

gabriel-tama commented Feb 7, 2021

There is workaround by using older version of create-react-app by running

npx create-react-app@4.0.1 my-app

I also have the same issue and when I tried this it throws an error like this,

You are runningcreate-react-app` 4.0.1, which is behind the latest release (4.0.2).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:

  • npm uninstall -g create-react-app
  • yarn global remove create-react-app

The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/

npm ERR! code 1
npm ERR! path C:\Users\LENOVO\Gab's
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-react-app cra

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users*\AppData\Local\npm-cache_logs\2021-02-07T02_06_15_415Z-debug.log
`

@HakamMssarwe
Copy link

Don't know what's causing this but I fixed the problem by creating a new user in the PC and by deleting the current one that had the problem

@abshnko
Copy link

abshnko commented Feb 8, 2021

Having the same issue - newly set-up react app isn't working (v4.0.2), and when trying to use v4.0.1 it says it's not the latest release

@fabiangamboa95
Copy link
Author

Okay. Now it works with no problem. Not full sure of what happened. The only relevant thing i can tell i did that may change something was: npm cache verify. If u still face this issue try this and comment if it works for u. Thanks!

@RaeganTysh
Copy link

RaeganTysh commented Feb 8, 2021

I am also having the same issue with (v4.0.2) and npm (v7.5.2)

@RaeganTysh
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

@KlentinMollai
Copy link

@RaeganTysh your latest post worked for me.
Thank you

@Aditya-1295
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

worked for me , thankyou so much !

@sleekcharly
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

Didn't work for me, still getting the same error

@abubakir1997
Copy link

abubakir1997 commented Apr 4, 2021

Same for me, using react-scripts 4.0.1 in a monorepo and still getting this error. Tried removing all node_module folders and did a clean install of the entire monorepo but still getting the same error. Also my react-script is not hoisted.

@mirellemartis12
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

thankyou so much for this!

@hasanrana21
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

thanks a lot its work

@mirrzamustafa
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

Thank you!!!!

@mirrzamustafa
Copy link

@alisscco If you are asking about what command line or what software am I using for react then it is VS Code.

@warferton
Copy link

warferton commented Apr 14, 2021

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

Thanks a lot, it helped! Sadly, the issue still happens to be present in the newer version...

@w0nche0l
Copy link

wait, so was there an actual solution to this problem? Is the CRA team aware of this? Will this be fixed in a future update of CRA?

@NeilCarlos
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

Thanks man!, it's working.

@nitink167
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

This solution worked for me too. Thanks a lot.

@Yasiru-Deshan
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

Thank you! It worked for me

@RedSquirrrel
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

It worked for me. Thank you so much!

@alzeih
Copy link

alzeih commented Jun 6, 2021

@fabiangamboa95 This is only a guess, but I see that the path with aws's has a single quote in it.

#10964 also has a single quote in the path with a similar error.

@harmonikas996
Copy link

✅✅✅

@alzeih I can confirm that in my case stupid single quote ' was part of my computer's name (e.g. dummy'sPC). After moving out the project folder to a higher level (I moved it to C:/Users/my-app) and reinstalling node_modules everything is working properly.

This is not a first time for me having issues because of that stupid single quote, but after some time you simply forget about that until you get to the point when there is no logical explanation for bugs you're encountering while programming.

Thank you so much @alzeih for reminding me of this bug.

@KutnerUri
Copy link

KutnerUri commented Jun 13, 2021

any idea what is the root cause of this?

I'm getting this error outside of CRA, and I'm trying to figure it out.
What changed in 4.0.2 that caused it?

@haptn
Copy link

haptn commented Jun 20, 2021

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

Thanks you so much! It works for me.
The version got error was 4.0.3.

@fabiangamboa95
Copy link
Author

@fabiangamboa95 This is only a guess, but I see that the path with aws's has a single quote in it.

#10964 also has a single quote in the path with a similar error.

yes.. ahahaha. that's the thing. if there's a single quote on the path string react-scripts > 4.0.1 do not work

@Ashraf840
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

Works for me. Thank you @RaeganTysh

@jooguilhermesc
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

Works for me! Thanks, man! \õ/

@Yogev-Strauber
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

KING ! thanks

@Re3zD3V
Copy link

Re3zD3V commented Jul 29, 2021

Hey guys ! Seems like I have found what was causing the issue for me. As someone else was stating : there was a single quote in one of the parent folder's name. The path was something like "c://blabla/react's_basics/my_app", I just removed the single quote to have "c://blabla/react_basics/my_app" and now it does work very fine.

Hope it helps.

@LeoDarpan
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.
This works, I 100% confirm it. This solution has my approval! Jokes apart, hehe!

@CymonMachera
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

It worked for me too

@abhayrp2000
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

worked for me, thank you so much.

@alexandrebenkendorf
Copy link

For those still facing this issue:

The problem was the ' (single quote) in the path/dir.
I removed any special char and blank space and it worked.
Didn't need to downgrade anything.

@ahmad-PH
Copy link

Update - I went into the package.json and changed the react-scripts to 4.0.1 and typed npm install(terminal) and re-ran it and it fixed the issue. Hope this helps.

Omg, you're a lifesaver! I was really, really, really frustrated with this error. This solved it. Why is there such a big issue with react that has such an arcane and crpytic error message and it's not being addressed?!

@edelynnm
Copy link

Same for me, using react-scripts 4.0.1 in a monorepo and still getting this error. Tried removing all node_module folders and did a clean install of the entire monorepo but still getting the same error. Also my react-script is not hoisted.

Have you discovered the fix? changing react-scripts to 4.0.1 did not also worked for me :(

@KutnerUri
Copy link

I don't remember how I solved it, but it was coming and going depending on some race condition and source code errors.
I did manage to improve it by using @pmmmwh/react-refresh-webpack-plugin/loader directly, which made the loaders more consistent. See here - pmmmwh/react-refresh-webpack-plugin#456 (comment)

This only makes sense if you ejected CRA and have some custom loaders

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

No branches or pull requests