1

When creating react app, I keep running into this error. Each time I create a new react app, I delete the following files, and import statements, to set up a basic starting point using react:

  1. favicon.ico
  2. logo192.png
  3. logo512.png
  4. manifest.json
  5. robots.txt
  6. App.css
  7. logo.svg
  8. reportWebVitals.js
  9. setupTests.js
  10. App.test.js

Until recently, I've never had rendering issues by following this process. Now I am receiving a Module not found: Error: Can't resolve './logo.svg' error. Error is found in "./src/App.js" which I've included below:

import './App.css';

function App() {
  return (
    <div className="App">
    </div>
  );
}

export default App;

As you can see, there's no import statement for "./logo.svg", so I am not understanding why this error is occurring. I've tried restarting the server, deleting node_modules and package-lock.json then reinstalling using npm install, reinstalling app using npx create-react-app, installing react app globally using npm install -g create-react-app, restarting computer, but all to no avail. Any help would be greatly appreciated. Thank you.

#UPDATE# I've discovered a workaround for the "module not found" errors. I deleted the files that gave me the errors, in this case, "App.js". Then I recreated those files with the appropriate boilerplate code. That resolved the errors. Now when rendering, the content refuses to display and I am not sure why that is happening now. I'm also not getting any console errors in the browser. Any help would be appreciated.

1
  • FINAL UPDATE I was able to get everything working by using the workaround I stated above. For the rendering issue, I believe that I was not saving my file after I made edits so now everything's working.
    – Louis B.
    Commented Aug 29, 2022 at 16:03

5 Answers 5

1

Be sure the files that you removed 'logo' from are properly saved before running

0

Check in your public/index.html if logo.svg is called there.

1
  • It's not called in index.html file.
    – Louis B.
    Commented Aug 21, 2022 at 5:01
0

Search logo.svg in all folders of your project with the help of VScode, file explorer or any other tool of your choice.

It must have been called somewhere and then remove it from there.

Also, restart the whole server after that as a precation.

1
  • Tried searching for logo.svg and nothing found but still receiving error.
    – Louis B.
    Commented Aug 21, 2022 at 5:05
0

go to index.js and app.js files and remove ./logo.svg (files that you are deleted) import class and save the page CTRL+S and again start the project.

-1

Delete any gaps between the lines in "App.js" and save; then npm run the program.. you will not get the error.

i had got the same error.. after doing this i resolved the problem.

2
  • Deleting gaps will have no effect. If your problem was resolved it must have been because of something else.
    – zoran404
    Commented Dec 28, 2023 at 2:37
  • send me your file.. will resolve it Commented Jan 21 at 20:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.