-2

When I am starting a react app by "npm start" command in VScode terminal, it starts to loading forever on the browser. I am completely new to that so I have no idea what and where could go wrong. I have read that it may be because of mistakes in code so I deleted all the things which caused "compiled with warnings", but even though now terminal says "compiled successfully", nothing changed. In the browser it is stuck on loading...

Note that the development build is not optimized. To create a product build, use npm run build.

Does it have something to do with a problem? Looking forward to understand better what is going on. Thanks!

Update: so I loaded an index.html file through live server extension in vscode and opened up developer tools and I saw a bunch of problems, which are all referring to a syntax error in the very beginning of the initial htmls code:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />

That is what I see on dev tools:

dev tools errors

Also, I tried "git status" in git bash and I see "nothing added to commit but untracked files present (use "git add" to track)" and it lists ALL of the files from my user folder.

Important note: earlier it was all fine and never have I ever seen all of these folders in a bash after running git status. Plus, I was even able to render react app.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Karina
  • 57
  • 1
  • 9

2 Answers2

0

I accidentally deleted the package.json. Restoring it solved my problem.

quicklikerabbit
  • 3,257
  • 6
  • 26
  • 39
Karina
  • 57
  • 1
  • 9
0

the main problem are:

  1. You create an infinite Component, nesting the parent component in the parent component https://i.stack.imgur.com/ngl1s.png
  2. You import the wrong Component path so that it creates a nesting Component
  • double-check your path is exactly correct
  • or check by Comment your code, circling the Component that makes an error then fixing it

so if you can't solve it remember your Component is nesting, then it makes infinite localhost loading

I solved by myself

lam
  • 1
  • 1