【问题标题】:Error: Cannot find module 'react-dev-utils/ignoredFiles'错误:找不到模块“react-dev-utils/ignoredFiles”
【发布时间】:2019-08-24 12:49:34
【问题描述】:

我将 React 更新到 16.3.0,我的应用程序因 Error: Cannot find module 'react-dev-utils/ignoredFiles' 而崩溃。 我尝试将此命令写入控制台:npm install --save-dev react-scripts,但这无济于事,否则我尝试从项目中删除节点模块并使用npm i 重新安装它,但没有任何结果。

来自 package.json 的依赖:

"dependencies": {
    "autoprefixer": "7.1.2",
    "babel-core": "6.25.0",
    "babel-eslint": "7.2.3",
    "babel-jest": "20.0.3",
    "babel-loader": "7.1.1",
    "babel-preset-react-app": "^3.0.2",
    "babel-runtime": "6.26.0",
    "case-sensitive-paths-webpack-plugin": "2.1.1",
    "chalk": "1.1.3",
    "css-loader": "0.28.4",
    "dotenv": "4.0.0",
    "eslint": "4.4.1",
    "eslint-config-react-app": "^2.0.0",
    "eslint-loader": "1.9.0",
    "eslint-plugin-flowtype": "2.35.0",
    "eslint-plugin-import": "2.7.0",
    "eslint-plugin-jsx-a11y": "5.1.1",
    "eslint-plugin-react": "7.1.0",
    "extract-text-webpack-plugin": "3.0.0",
    "file-loader": "0.11.2",
    "fs-extra": "3.0.1",
    "html-webpack-plugin": "2.29.0",
    "jest": "20.0.4",
    "object-assign": "4.1.1",
    "postcss-flexbugs-fixes": "3.2.0",
    "postcss-loader": "2.0.6",
    "promise": "8.0.1",
    "prop-types": "^15.6.0",
    "radium": "^0.19.4",
    "react": "^16.3.0",
    "react-dom": "^16.3.0",
    "style-loader": "0.18.2",
    "sw-precache-webpack-plugin": "0.11.4",
    "url-loader": "0.5.9",
    "webpack": "3.5.1",
    "webpack-dev-server": "2.7.1",
    "webpack-manifest-plugin": "1.2.1",
    "whatwg-fetch": "2.0.3"
  }

【问题讨论】:

    标签: javascript reactjs


    【解决方案1】:

    我假设你使用的是“create-react-app”

    我建议你删除 package-lock.json 然后运行 ​​npm install

    在大多数情况下,在 package.json 和中碰撞 react-scripts 版本 在这个文件夹中运行 npm install 就足够了。

    npm install --save --save-exact react-scripts@1.1.4
    

    create-react-app update

    【讨论】:

    • 我有工作项目并在 package.json 中将 react 版本更改为 16.3,然后运行 ​​npm i
    • 我只有这个警告npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    • npm install ajv
    • 没用。
    • 我更新的答案呢,建议你删除package-lock.json
    猜你喜欢
    • 2020-08-22
    • 2022-07-26
    • 1970-01-01
    • 2019-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-09
    • 2020-01-12
    相关资源
    最近更新 更多