You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决构建Theia扩展时出现的gyp ERR! `make`失败退出码2错误?

Theia扩展构建报错求助

问题详情

克隆第三方仓库开发Theia扩展时,执行yarn构建命令触发以下错误:

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit ( [my directory]/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 3.10.0-1160.80.1.el7.x86_64
gyp ERR! command "/afs/[security]/app/vbuild/RHEL7-x86_64/nodejs/16.15.0/bin/node" "[my directory]/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd [my directory]/node_modules/@theia/node-pty
gyp ERR! node -v v16.15.0

已尝试的排查操作:

  • 删除node_modules、package-lock.json、yarn.lock后重新安装
  • 将Node.js版本从16.15.0降级至14.x

但上述操作均未解决问题,执行npm install时还出现额外错误:

npm ERR! code 1
npm ERR! path [my directory]/electron
npm ERR! command failed
npm ERR! command sh -c theia build --mode development
npm ERR! Updated dependencies, please run "install" again

当前环境信息:

OS : Red Hat Enterprise Linux Server release 7.9 (Maipo) 
node version : v16.15.0 
npm version : 8.5.5 
yarn version : 1.7.0 
theia version : 1.x

请问是否有人遇到过相同问题,或知晓有效的解决方法?


内容的提问来源于stack exchange,提问作者Heerae Lee

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 15:40:24