Advice needed for resolving a React compiling error!

Hi everyone,
I’m trying to use react on my local computer, but once I enter npm start the browser opens with this error:
**Failed to compile
./src/index.js 1:59
Module parse failed: Unexpected token (1:59)
File was processed with these loaders:

  • ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
  • ./node_modules/babel-loader/lib/index.js
    You may need an additional loader to handle the result of these loaders.

$RefreshRuntime$ = require(‘C:/Users/anewt/Documents/Allie’s_Folder/Projects/React_Apps/jammming/jammming/node_modules/react-refresh/runtime.js’);
| $RefreshSetup$(module.id);
|
This error occurred during the build time and cannot be dismissed.**

I tried installing react using both create-react-app and npm i -S… in separate directories. Neither showed any errors until the server tries to run, then the same exact error appears in the browser :angry: Someone please help! What does this error mean and how can I resolve it :question:

Could that be related to a previous installation of CRA. Have you tried the command they say on this page? Specifically this part:

If you’ve previously installed create-react-app globally via npm install -g create-react-app , we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.

And then, of course, again, in your parent directory, do:

npx create-react-app my-app

cd my-app

npm start

Would that help?

Thank you! I’ve been trying to resolve this error for days. It’s nice to finally have a new direction of what to try next😊Just to clarify, do I need to uninstall CRA each time I create a new React project? Thanks again!

:purple_heart:AllieNewton:purple_heart:

1 Like

Yes, I guess so, since I believe you only install it locally (i.e.: project-scoped).

Hi sorry to bother you again, but I tried what you suggested, but I’m still getting the same error😢 Thoughts??

:purple_heart:AllieNewton:purple_heart:

No need to apologize! We’re in these forums to help each other.

Look at how interesting of a comment there is here.

Apparently if:

  1. you’re on Windows
  2. you have a single quote/apostrophe in part of the path

there could be trouble. Sounds petty much like your situation, since you seem to be on C:/Users so it’s a Windows, plus you have a folder called Allie’s_Folder.

Possible solution? Well, can you create the project on a different path without single quotes/apostrophes (or of course also you could change the name of that folder, removing only the single quote/apostrophe). And then try again.

Would that work?

1 Like

Hi sorry for the delayed reply… You’re correct, my OS is Windows 10😊 So once I remove the ’ character, do I just cd back into the app and rerun npm start or should I just start over?

Hello, I have great news! I removed the ‘ from my folder name and now it’s working perfectly😁 Thank you so much! There’s no way I could have resolved this myself. Especially since the error itself is misleading. Thank you again and all the best!

:purple_heart:AllieNewton:purple_heart: