0

I am using react inside my django application but now I am facing this error.module not found but module is there.

package.json

    {
    "name": "lead-manager",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "dev": "webpack --mode development --watch ./leadmanager/frontend/src/index.js --output-path ./leadmanager/frontend/static/frontend/main.js",
        "build": "webpack --mode production ./leadmanager/frontend/src/index.js --output-path ./leadmanager/frontend/static/frontend/main.js"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "devDependencies": {
        "@babel/core": "^7.19.3",
        "@babel/preset-env": "^7.19.3",
        "@babel/preset-react": "^7.18.6",
        "babel-loader": "^8.2.5",
        "babel-plugin-transform-class-properties": "^6.24.1",
        "webpack": "^5.74.0",
        "webpack-cli": "^4.10.0"
    },
    "dependencies": {
        "prop-types": "^15.8.1",
        "react": "^18.2.0",
        "react-dom": "^18.2.0"
    }
}

and App.js is following where console show me error

    import React from "react";
    import ReactDOM from "react-dom/client";
    import Header from "./layout/Header";
    import Dashboard from "./leads/Dashboard";
    
    const App = () => {
        return (
            <div>
                <Header />
                <Dashboard />
            </div>
        );
    };
    const root = ReactDOM.createRoot(document.getElementById("app"));
    root.render(<App />);

and project tree is following

    ├

    ── src
    │   │   ├── components
    │   │   │   ├── App.js
    │   │   │   ├── Form.jsx
    │   │   │   ├── layout
    │   │   │   │   └── Header.js
    │   │   │   ├── leads
    │   │   │   │   └── Dashboard.jsx
    │   │   │   └── Leads.jsx
    │   │   └── index.js
    │   ├── static
    │   │   ├── css
    │   │   │   └── style.css
    │   │   └── frontend
    │   │       └── main.js
    │   │           └── main.js
    │   ├── templates
    │   │   └── frontend
    │   │       └── index.html

according to my knowledge path is correct. Everything is fine Header component is working and Dashboard is not working.

3
  • Did you run npm install? Commented Oct 15, 2022 at 9:08
  • not working sir Commented Oct 15, 2022 at 9:44
  • Please show your project tree from the root folder of your project Commented Oct 15, 2022 at 10:32

1 Answer 1

1

Did you install npm? It is major issue with npm installation. try out this in local directory

   npm install
Sign up to request clarification or add additional context in comments.

1 Comment

yes i have done it but not working

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.