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

Time:12-01

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;

  
  • List item npm WARN ERESOLVE overriding peer dependency

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


CodePudding user response:

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

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

CodePudding user response:

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

  • Related