0

I have a NextJS application on my Windows machine and have been able to use the zeromq package without any issue. But when I attempt to install the same project on my CentOS 7.9 VM, I get some error related to node-gyp. I tried following some steps on other threads but nothing solves my problem. I have also removed zeromq from package.json, deleted package-lock.json, and cleared my npm cache so that I can try a fresh installation of zeromq:

npm install zeromq

Here is the error log:

npm ERR! code 1
npm ERR! path /home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq
npm ERR! command failed
npm ERR! command sh -c -- (shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build
npm ERR! make: Entering directory `/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/build'
npm ERR!   TOUCH 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
npm ERR!   ACTION binding_gyp_libzmq_target_build_libzmq 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
npm ERR! Downloading libzmq source from https://github.com/zeromq/libzmq/archive/20de92ac0a2b2b9a1869782a429df68f93c3625e.tar.gz
npm ERR! Building libzmq Release
npm ERR! cmake -S "libzmq-20de92ac0a2b2b9a1869782a429df68f93c3625e" -B ./build  -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/build/libzmq" -DCMAKE_INSTALL_LIBDIR=lib -DBUILD_STATIC=ON -DBUILD_TESTS=OFF -DBUILD_SHARED=OFF -DWITH_DOCS=OFF -DWITH_LIBSODIUM=ON -DWITH_LIBSODIUM_STATIC=ON
npm ERR! cmake --build ./build --config Release --target install
npm ERR!   TOUCH Release/obj.target/libzmq.stamp
npm ERR!   CXX(target) Release/obj.target/zeromq/src/context.o
npm ERR! rm 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
npm ERR! make: Leaving directory `/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/build'
npm ERR! /lib64/libc.so.6: version `GLIBC_2.33' not found (required by /home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/prebuilds/linux-x64/node.napi.glibc.node)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@16.18.1 | linux | x64
npm ERR! gyp info find Python using Python version 3.6.8 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/fsmdevuser/.cache/node-gyp/16.18.1/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/fsmdevuser/.cache/node-gyp/16.18.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/fsmdevuser/.cache/node-gyp/16.18.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! /bin/sh: cmake: command not found
npm ERR! /bin/sh: cmake: command not found
npm ERR! g++: error: unrecognized command line option ‘-std=gnu++14’
npm ERR! g++: error: unrecognized command line option ‘-std=c++17’
npm ERR! make: *** [Release/obj.target/zeromq/src/context.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 3.10.0-1160.76.1.el7.x86_64
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq
npm ERR! gyp ERR! node -v v16.18.1
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fsmdevuser/.npm/_logs/2023-01-30T08_31_00_652Z-debug-0.log

If it helps, my Node version is 16.18.1, npm is 8.19.2 and node-gyp --version returns 0.10.6

Edit: I attempted to sudo yum install cmake to see if it fixes anything and now I'm getting a shorter error message

npm ERR! code 126
npm ERR! path /home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq
npm ERR! command failed
npm ERR! command sh -c -- (shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build
npm ERR! sh: /home/fsmdevuser/fsm-poc/web-app/node_modules/.bin/cross-env: Permission denied

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fsmdevuser/.npm/_logs/2023-01-30T08_50_27_526Z-debug-0.log
NitinMa2
  • 3
  • 2

1 Answers1

0

I had the same issue yesterday with another package heapdump on Ubuntu 22. The solution is to install node-gyp globally:

sudo npm install -g node-gyp
Stanley Ulili
  • 702
  • 5
  • 7
  • This doesn't seem to work in my case, unfortunately. – NitinMa2 Jan 30 '23 at 09:00
  • Upon reading your logs in-depth I noticed this `g++: error: unrecognized command line option ‘-std=c++17’`. This could be the result of having an older gcc compiler. Perhaps, try to update it. See [https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/](https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/). Let me know if that solves your issue. – Stanley Ulili Jan 30 '23 at 09:13
  • Nope, doing this throws new [error messages](https://jpst.it/35wYc) – NitinMa2 Jan 30 '23 at 09:35
  • Ok, The error message that stood out is `npm ERR! /lib64/libc.so.6: version `GLIBC_2.33' not found`. So see [https://stackoverflow.com/questions/50564999/lib64-libc-so-6-version-glibc-2-14-not-found-why-am-i-getting-this-error](https://stackoverflow.com/questions/50564999/lib64-libc-so-6-version-glibc-2-14-not-found-why-am-i-getting-this-error). The instructions are for glibc 2.14, the logs says 2.33 is missing. So be sure to substitute the versions accordingly. The glib 2.33 package is at [https://ftp.gnu.org/gnu/glibc/glibc-2.33.tar.gz](https://ftp.gnu.org/gnu/glibc/glibc-2.33.tar.gz) – Stanley Ulili Jan 30 '23 at 09:52
  • Great, I'm a bit inexperienced with this but I followed your instructions along with some additional problem-solving along the way and managed to get it working! If it helps anyone else, I'd suggest specifying the version of zeromq that you're installing. In my case, I did `npm install zeromq@5` – NitinMa2 Jan 30 '23 at 15:58
  • I am so happy to hear that you got it resolved! Best of luck. – Stanley Ulili Jan 30 '23 at 16:26