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

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

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

Related

Trying to install an app with node-sass on WSL. Getting "gyp ERR! stack Error: `make` failed with exit code: 2"

I was trying to install some magento storefront app that requires linux to run on WSL. I managed to get most things working, but in the end I'm stuck at trying to install the dependencies. When it tries to install node-sass, I get this error:
make: Leaving directory '/mnt/c/Github/psp-storefront-magento2/node_modules/node-sass/build'
make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/mnt/c/Github/psp-storefront-magento2/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (node:events:390:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 4.4.0-19041-Microsoft
gyp ERR! command "/home/lursmani/.nvm/versions/node/v16.10.0/bin/node" "/mnt/c/Github/psp-storefront-magento2/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /mnt/c/Github/psp-storefront-magento2/node_modules/node-sass
gyp ERR! node -v v16.10.0
I read that deleting yarn.lock and installing again should fix this, but it hasn't helped in my case. Would greatly appreciate some help with this, if anyone knows what's funky here.
I found the solution. Apparently GYP has issues with the latest version of Node (16). I had to downgrade to Node 14 and then it worked correctly.

I can not do yarn add because node-sass fails

I have a problem with yarn add && yard build.
Especially node-sass
Whenever I'm trying to run node-sass it is giving me this error
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/user/all001/app/themes/alliance/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 4.15.0-54-generic
gyp ERR! command "/home/user/.nvm/versions/node/v14.4.0/bin/node" "/home/user/all001/app/themes/alliance/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/user/all001/app/themes/alliance/node_modules/node-sass
gyp ERR! node -v v14.4.0
gyp ERR! node-gyp -v v3.8.0
I really don't know how to fix this. Any suggestions, please?
I encountered the same error message when performing npm install node-sass. The only solution for me at the moment is to choose an older node version. Both v14 and v12 did not work, so I went back to v10. Luckily I had Node installed using nvm. You can run nvm install v10.22.1, for example. Use nvm ls-remote to see the available versions.
One difference, however, is that I tried to execute it on a Mac (System Darwin 19.6.0)

Compiling Error with sha3 & Ethereum Mist

Unhandled rejection Error: Error: npm exited with code 1
Output:
> sha3#1.2.0 install /home/user/mist/dist_mist/app/node_modules/sha3
> node-gyp rebuild
make: Entering directory '/home/user/mist/dist_mist/app/node_modules/sha3/build'
CXX(target) Release/obj.target/sha3/src/addon.o
sha3.target.mk:96: recipe for target 'Release/obj.target/sha3/src/addon.o' failed
make: Leaving directory '/home/user/mist/dist_mist/app/node_modules/sha3/build'
Error output:
In file included from /usr/include/stdint.h:25:0,
from /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint.h:9,
from /home/user/.electron-gyp/.node-gyp/iojs-1.4.15/deps/v8/include/v8.h:19,
from /home/user/.electron-gyp/.node-gyp/iojs-1.4.15/src/node.h:42,
from ../src/addon.cpp:1:
/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory
compilation terminated.
make: *** [Release/obj.target/sha3/src/addon.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.10.0-28-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/user/mist/dist_mist/app/node_modules/sha3
gyp ERR! node -v v8.2.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sha3#1.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sha3#1.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
On Ubuntu 16.04:
I am getting this error after running gulp --linux in ~/mist.
I've tried researching for sha3 errors, I find similar posts, but cannot find a solution.
What do I do to fix? Thanks.
Faced the same problem when trying to install a truffle box. There is an issue with installing the sha3 dependency.
Somehow using a specific version of nvm solves the problem.
$ nvm install 10.16.0
$ nvm alias default 10.16.0
type in : npm install sha3 and then sudo yarn
that will work for

installing d3 using npm causes contextify errors

Getting some mystifying contextify errors (but other installs seem to go fine.)
npm install d3
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install
Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.
[C:\Users\dinesh\m3\node_modules\d3\node_modules\jsdom\node_modules\contextify\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\dinesh\m3\node_modules\d3\node_modules\jsdom\node_modules\contextify
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! contextify#0.1.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
You've probably moved on at this point, but for future googlers:
Upgrade to D3.js v3.5.4+
jsdom is a dependency of d3, and jsdom requires contextify, which uses native modules (node-gyp). Native modules are hard to build on some platforms, so d3 made jsdom a development dependency (not installed by default) as of v3.5.4.
Related: D3.js commit and D3.js issue.

npm install odbc fails on OSX and Ubuntu

I'm having an issue install the odbc package on both OSX and Ubuntu.
I have unixODBC installed on both machines.
Here is the output of issuing "npm install odbc":
npm http GET https://registry.npmjs.org/odbc
npm http 304 https://registry.npmjs.org/odbc
> odbc#0.6.3 preinstall /home/notes/as400/node_modules/odbc
> node-gyp configure build
Traceback (most recent call last):
File "/usr/share/node-v0.10.26-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in <module>
sys.exit(gyp.script_main())
AttributeError: 'module' object has no attribute 'script_main'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-v0.10.26-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.11.0-12-generic
gyp ERR! command "node" "/usr/share/node-v0.10.26-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/notes/as400/node_modules/odbc
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! odbc#0.6.3 preinstall: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the odbc#0.6.3 preinstall script.
npm ERR! This is most likely a problem with the odbc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls odbc
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/share/node/bin/node" "/usr/share/node/bin/npm" "install" "odbc"
npm ERR! cwd /home/notes/as400
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/notes/as400/npm-debug.log
npm ERR! not ok code 0
EDIT 03/05/2014
I installed unixODBC on my Mac using Macports without any issues. Now when I try "npm install odbc --save", I get the following error about sql.h missing:
npm http GET https://registry.npmjs.org/odbc
npm http 304 https://registry.npmjs.org/odbc
> odbc#0.6.3 preinstall /Users/patrick/IdeaProjects/XTL/vouchers-paid/node_modules/odbc
> node-gyp configure build
CXX(target) Release/obj.target/odbc_bindings/src/odbc.o
In file included from ../src/odbc.cpp:25:
../src/odbc.h:29:10: fatal error: 'sql.h' file not found
#include <sql.h>
^
1 error generated.
make: *** [Release/obj.target/odbc_bindings/src/odbc.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /Users/patrick/IdeaProjects/XTL/vouchers-paid/node_modules/odbc
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
Here is what worked for me (OSX 10.10.2)
Installing unixODBC via MacPorts did not work. The port itself
installs and automatically updates the include paths and the compiler
finds sql.h. But then the linker fails.
Installing unixodbc via Homebrew works. The include paths are not
updated, but this can be fixed, as indicated by the other answers.
For the installation of the odbc package you can use the following shell script:
#!/usr/bin/env bash
SRC_ODBC=/usr/local/Cellar/unixodbc/2.3.2_1/include
export C_INCLUDE_PATH=$C_INCLUDE_PATH:$SRC_ODBC
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:$SRC_ODBC
npm install odbc
As stated on npmjs.org there are additional binaries that need to be installed:
> on Ubuntu/Debian sudo apt-get install unixodbc unixodbc-dev
> on OSX using macports.org sudo port unixODBC
for more info: https://www.npmjs.org/package/odbc
sudo port unixODBC
is also wrong.
sudo port install unixodbc
is right.
Port install the lib and header files in other directories /opt/local/include and /opt/local/lib. To use them you have to told npm or the environment about.
But no idea how. May someone more experienced.
Or you use homebrew:
brew install unixodbc
That will work.
After installing using
sudo port install unixodbc
$ C_INCLUDE_PATH=/Where_You_Installed/ibm/dsdriver/include
$ CPLUS_INCLUDE_PATH=/Where_You_Installed/ibm/dsdriver/include
$ export C_INCLUDE_PATH
$ export CPLUS_INCLUDE_PATH
Then run
npm install ibm_db

Resources