npm install – Issues Upgrading Node.js from 14 to 22 with libxslt and node-gyp Errors
I am trying to upgrade my Node.js application from Node.js 14 to Node.js 22. However, during the upgrade process, I encounter errors while running npm install, specifically related to libxslt and node-gyp.
Environment
Node.js version: 22.3.0
npm version: 9.3.0
OS: Linux (x64)
Upgraded node-gyp to version 10 and downgraded back to version 9.
Ensured Python is installed (Python 3.8.10 is being used by node-gyp).
Verified that dependencies are being rebuilt during npm install.
Despite these efforts, the issue persists.
npm ERR! code 1
npm ERR! path /path/to/project/node_modules/libxslt
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
make: Entering directory ‘/path/to/project/node_modules/libxslt/build’
CC(target) Release/obj.target/libexslt/deps/libxslt/libexslt/common.o
…
npm ERR! ../deps/libxslt.config/linux/x64/config.h:53: warning: “HAVE_LIBPTHREAD” redefined
…
npm ERR! ../deps/libxslt/libexslt/functions.c:224: warning: cast between incompatible function types
…
npm ERR! gyp ERR! stack Error: make failed with exit code: 2
Read more here: Source link
