【问题标题】:React App failed to compile - Module not found: Can't resolve 'react'React App 无法编译 - 找不到模块:无法解析“反应”
【发布时间】:2019-04-29 05:06:05
【问题描述】:

我正在使用 create-react-appreact-bootstrap,当我运行 npm start 时出现此错误:

编译失败../node_modules/@restart/context/forwardRef.js

找不到模块:无法解析“C:\Users...\node_modules@restart\context”中的“react”

此错误发生在构建期间,无法消除。

我已经尝试删除 package-lock.json 并再次运行 npm install 但没有帮助。

【问题讨论】:

  • 检查 ./node_modules 文件夹中是否存在“react”包。还要完全删除 node_modules。 node_modules 将再次生成。希望这会有所帮助。
  • this的可能重复
  • 也许你需要做一个npm install
  • 删除node_modules,运行npm cache clean并再次运行npm install

标签: reactjs create-react-app react-bootstrap


【解决方案1】:

我遇到了一些错误。我尝试使用以下步骤;它最终会运行。

npm cache clean --force
npm cache verify

然后我删除了node_modules,然后我运行下面的代码

npm install --force

【讨论】:

    猜你喜欢
    • 2021-01-12
    • 1970-01-01
    • 2021-03-08
    • 2018-07-23
    • 2019-05-23
    • 1970-01-01
    • 2022-10-25
    • 1970-01-01
    • 2021-04-10
    相关资源
    最近更新 更多