I’m trying to deploy a small Node.js backend and I use socket.io (which uses msgpack) as part of the system. The build fails due to a compilation error in one of the packages being installed. (msgpack, error is in node-gyp)
npm ERR! code 1
npm ERR! path /opt/render/project/src/accit-server/node_modules/msgpack
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
...
npm ERR! /opt/render/.cache/node-gyp/21.1.0/include/node/node.h:711:28: error: ‘std::string_view’ has not been declared
npm ERR! Environment* env, std::string_view main_script_source_utf8);
npm ERR! ^~~~~~~~~~~
...
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 (/opt/render/project/nodes/node-21.1.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:515:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Linux 5.15.0-1053-aws
npm ERR! gyp ERR! command "/opt/render/project/nodes/node-21.1.0/bin/node" "/opt/render/project/nodes/node-21.1.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /opt/render/project/src/accit-server/node_modules/msgpack
npm ERR! gyp ERR! node -v v21.1.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok
The compilation for node-gyp
is failing because something is configured incorrectly. I have Node.js version set to v21.6.2 and everything else is at the defaults.
Any help would be appreciated.