How to solve gyp ERR! stack Error: `make` failed with exit code: 2?

939 Views Asked by At

I cloned a repo made by someone else to develop theia extension.

I ran the yarn command for the build, but the following error occurs.

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

As I searched on Google, I deleted node_modules, package-lock.json, yarn.lock, and downgraded node version to 14, but the same error occurs.

When I do npm install I get the following error:

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

Did anyone else encounter this issue, or knows how to fix it?

Here are the details of the environment I'm using:

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
1

There are 1 best solutions below

1
On

As the error shows npm and yarn arnet able to install the theia npm package. Check that you are using the correct theia version and its supported by your node and operating system. im not sure what you are running on windows or linux its worth checking this out https://github.com/eclipse-theia/theia/issues/188