【问题标题】:Module not found: Can't resolve 'react/lib/React' in 'C:\Users\name\ecom\node_modules\react-dom\lib'找不到模块:无法在“C:\Users\name\ecom\node_modules\react-dom\lib”中解析“react/lib/React”
【发布时间】:2021-03-20 06:04:38
【问题描述】:

我正在做一个反应项目,突然发生了这个错误,说,


编译失败 ../node_modules/react-dom/lib/ReactMount.js 未找到模块:无法解析“C:\Users\Angelin\ecom\node_modules\react-dom\lib”中的“react/lib/React”

package.json:

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@ant-design/icons": "^4.0.0",
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.3",
    "@testing-library/user-event": "^12.6.2",
    "antd": "^4.11.2",
    "axios": "^0.21.1",
    "firebase": "^8.2.5",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-redux": "^7.2.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.1",
    "react-toastify": "^7.0.2",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.8",
     "body-parser": "^1.19.0",
    "bootstrap": "^4.6.0",
    "cloudinary": "^1.25.0",
    "cors": "^2.8.5",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-jwt": "^6.0.0",
    "firebase-admin": "^9.4.2",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.11.14",
    "morgan": "^1.10.0",
    "multiscroll-reactjs": "^1.0.2",
    "nodemon": "^2.0.7",
    "react-awesome-button": "^6.5.1",
    "react-bootstrap": "^1.5.2",
    "react-device-detect": "^1.17.0",
    "react-image-file-resizer": "^0.4.2",
    "react-multi-carousel": "^2.6.2",
    "react-responsive-carousel": "^3.2.13",
    "react-star-ratings": "^2.3.0",
    "slugify": "^1.4.6",
    "typewriter-effect": "^2.17.0",
    "web-vitals": "^0.2.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

请告诉我应该怎么做

【问题讨论】:

    标签: node.js reactjs


    【解决方案1】:

    这乍一看似乎是安装包的问题。

    您可以尝试删除node_modules 文件夹并使用npm installyarn install 重新安装所有软件包。

    如果这不起作用,那么你可以参考这个post

    【讨论】:

      猜你喜欢
      • 2018-03-16
      • 2018-09-21
      • 1970-01-01
      • 2021-11-24
      • 1970-01-01
      • 1970-01-01
      • 2017-03-31
      • 2019-10-12
      • 2020-11-05
      相关资源
      最近更新 更多