Home > database >  Module not found: Error: Can't resolve './logo.svg' error in React
Module not found: Error: Can't resolve './logo.svg' error in React

Time:08-21

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.

CodePudding user response:

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

CodePudding user response:

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.

  • Related