Errors in React

Hi Everyone,

I am facing this error. could anyone help me to solve it?

Compiled with problems:X

ERROR in ./src/index.js 10:0-60

Module not found: Error: Can’t resolve ‘./registerServiceWorker’ in ‘C:\Users\Mojgan\counter-app\src’

Sounds like it’s looking for a file named registerServiceWorker.js in your src folder but can’t find it. That seems like the sort of thing the create-react-app tool would generate, and I don’t know why yours is missing. If you don’t have a need for the React service worker, you could probably just delete line 10 in your index.js, and any other lines in that file which refer to the service worker.

1 Like

Thank you for your help. It solved after just removing it but I also had misstakes due writing uper-case and lower-case many places!

One more question , I am facing this error a lot:
"WARNING in src\components\movies.jsx
Line 2:8: ‘Like’ is defined but never used no-unused-vars

webpack 5.71.0 compiled with 1 warning in 679 ms"

Even, I have defined Like in my code!!!

You defined Like, but it sounds like you’re not using it. Try removing it and see if everything still works and if the error goes away.

1 Like

Thanks!

Still I am getting lots of errors :face_holding_back_tears:

Compiled with problems:X

ERROR

src\components\moviestable.jsx
Line 6:17: ‘movies’ is missing in props validation react/prop-types
Line 6:25: ‘onDelete’ is missing in props validation react/prop-types
Line 6:35: ‘onLike’ is missing in props validation react/prop-types
Line 6:43: ‘onSort’ is missing in props validation react/prop-types
Line 21:29: ‘movies.map’ is missing in props validation react/prop-types

Search for the keywords to learn more about each error.

This one is saying that you should add validation for the movies, onDelete, etc. props, as explained here and here. But, it can all be a bit confusing at first. If you don’t want to deal with these linting errors right now, you could disable the linting rule. For example in VS Code you can hover over the red squiggly and you’ll see the Quick Fix link which will give you some options for disabling the rule.

1 Like