sencerLeo
sencerLeo

Reputation: 23

How to resolve can't find module error in react.js

import { ColorModeContext, useMode } from "./theme";
import { CssBaseline, ThemeProvider } from "@mui/material";
import Topbar from "./scenes/global/Topbar";
import Sidebar from "./scenes/global/Sidebar";

function App() {
  const [theme, colorMode] = useMode();
  return (
    <ColorModeContext.Provider value={colorMode}>
      <ThemeProvider theme={theme}>
        <CssBaseline/>
        <div className="app">
          <main className="content">
            <Topbar/>
            <Sidebar/>           
          </main>
        </div>
      </ThemeProvider>
    </ColorModeContext.Provider>
  );
}
export default App;

  

npm WARN While resolving: [email protected]

npm WARN Found: [email protected]

npm WARN node_modules/react

npm WARN react@"^18.2.0" from the root project

npm WARN 16 more (@emotion/react, @emotion/styled, ...)

npm WARN

npm WARN Could not resolve dependency:

npm WARN peer react@"^16.3.0 || 17" from [email protected]

npm WARN node_modules/react-pro-sidebar/node_modules/react-slidedown

npm WARN react-slidedown@"^2.4.5" from [email protected]

npm WARN node_modules/react-pro-sidebar

npm WARN npm WARN Conflicting peer dependency: [email protected]

npm WARN node_modules/react

npm WARN peer react@"^16.3.0 || 17" from [email protected]

npm WARN node_modules/react-pro-sidebar/node_modules/react-slidedown

npm WARN react-slidedown@"^2.4.5" from [email protected]

npm WARN node_modules/react-pro-sidebar

npm WARN ERESOLVE overriding peer dependency

npm WARN While resolving: [email protected]

npm WARN Found: [email protected]

npm WARN node_modules/react-dom

npm WARN react-dom@"^18.2.0" from the r

oot project npm WARN 6 more (@mui/base, @mui/material, @testing-library/react,

...) npm WARN

npm WARN Could not resolve dependency: npm WARN peer react-dom@"^16.3.0 || 17" from [email protected]

npm WARN node_modules/react-pro-sidebar/node_modules/react-slidedown

npm WARN react-slidedown@"^2.4.5" from [email protected]

npm WARN node_modules/react-pro-sidebar

npm WARN npm WARN Conflicting peer dependency: [email protected]

npm WARN node_modules/react-dom

npm WARN peer react-dom@"^16.3.0 || 17" from [email protected]

npm WARN node_modules/react-pro-sidebar/node_modules/react-slidedown

npm WARN react-slidedown@"^2.4.5" from [email protected]

npm WARN node_modules/react-pro-sidebar


Upvotes: 2

Views: 293

Answers (2)

Alex Yepes
Alex Yepes

Reputation: 1195

Remove the .src/ part from the paths for those 2 imports

import Topbar from "./scenes/global/Topbar"
import Sidebar from "./scenes/global/Sidear"

Upvotes: 1

Laza Nantenaina
Laza Nantenaina

Reputation: 11

you should navigate to the root directory of your react project, then run npm install command to install all modules, and run npm run start to start your react app

Upvotes: 0

Related Questions