【问题标题】:why react-script build fails in cmd but succuss in npm scripts(npm run build)?为什么 react-script build 在 cmd 中失败但在 npm 脚本中成功(npm run build)?
【发布时间】:2020-04-05 20:24:21
【问题描述】:

命令 react-scripts build 总是失败,即使 react-scripts.cmd 存在于文件夹 node_modules/.bin/ 下 奇怪的是:npm run build(build: react-scripts build) 会成功运行

【问题讨论】:

  • 请不要张贴错误信息的图片。它们无法被 Google 索引,因此对其他人没有帮助。

标签: webpack create-react-app react-scripts


【解决方案1】:

您可能没有全局安装react-script,因此它位于本地node_module。

你可以用npx运行它

npx react-script build

或者提供一个路径...

【讨论】:

  • 谢谢。全局安装解决了我的问题。 npx 也很有用。第三种解决方案可能是:npm bin & react-scripts build.it will run local
【解决方案2】:
  1. 全局安装解决了我的问题。

  2. npx 也很有用。

  3. 第三种解决方案可能是:

npm bin 
react-scripts build.

它将在本地运行

【讨论】:

    猜你喜欢
    • 2022-11-16
    • 2020-12-31
    • 2020-11-28
    • 2018-09-19
    • 2020-09-14
    • 2021-03-26
    • 2017-10-05
    • 2018-04-30
    • 2020-09-20
    相关资源
    最近更新 更多