【问题标题】:cannot run "npm run build" for a react project on mac m1无法在 mac m1 上为 react 项目运行“npm run build”
【发布时间】:2021-05-20 19:46:29
【问题描述】:

我们有一个 react 项目,可以在英特尔 mac 上毫无问题地构建。 但是在 mac m1 上,该项目不想构建

这是npm run build的唯一回复

The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.
npm ERR! code 1
npm ERR! path /Users/.../projects/app
npm ERR! command failed
npm ERR! command sh -c react-scripts build

安装了 node v15.8.0 以及 npm v7.5.0。 node_modules 是最新的。

【问题讨论】:

  • running sh -c "react-scripts build" 给出相同的结果:构建失败,因为进程退出得太早。这可能意味着系统内存不足或有人在进程中调用了kill -9
  • 还有系统有16GB,正在使用6GB,内存够用

标签: reactjs macos npm apple-m1


【解决方案1】:

我认为这里最好的解决方案是从自制软件升级/重新安装节点(这对我有帮助)。我在终端上运行了brew upgrade node,之后它似乎工作正常。

【讨论】:

    猜你喜欢
    • 2022-08-05
    • 2019-11-15
    • 2017-10-05
    • 2021-06-14
    • 2020-05-16
    • 2023-03-24
    • 2021-03-03
    • 1970-01-01
    • 2016-05-02
    相关资源
    最近更新 更多