#unexpected token

17 messages · Page 1 of 1 (latest)

fleet gorge
#

Hey, been at this for half an hour and I cannot get this to work lol

It's showing me this error when I start NPM (I'm following the course on youtube and I just have very basic code inside the react render

when i run it it says this, that it's missing a loader or something, i've already went through the documentation and tried to fix it but couldn't... can anyone help? thanks

I added the webpack.config.js hoping it would fix it, I don't even know if it's using it lol (i'm very new to react)

trim cosmos
#

Hi @fleet gorge if you're using Vite you shouldn't need an extra webpack.config file (it's all handled by vite.config.js, but if you're using Vite I'm not sure why your index.html file is in src (it's usually placed in the root of the project)

fleet gorge
#

I am not using Vite, sorry 😅

#

the webpack config thing it was just something I tried, tried installing loaders through CMD but it led nowhere...

trim cosmos
#

Ok, how did you set up this project?

fleet gorge
#

commands:

npx create-react-app components
cd components
npm start

trim cosmos
#

Ok

#

Can you screenshot your whole project folder structure please

fleet gorge
#

starting to think I did something wrong, hehe

I removed everything that was in the src folder so I could start (and write code) from scratch

trim cosmos
#

Ok, you have an extra index.html file which is confusing things. Take a look at the initial folder structure you get from create-react-app

#

index.html belongs in the public folder, not src

fleet gorge
#

ah i dont need to create a new one?

trim cosmos
#

Correct

fleet gorge
#

makes sense, i'll try that now, thank you!

#

i had to remove the import i had in line 3 of index.js file aswell, but that fixed it, thank you! 😛