nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
106.42k stars 29k forks source link

[regression] node-gyp: createConfigFile: Cannot assign to read only property 'cflags' of object '#<Object>' #53986

Open benbucksch opened 1 month ago

benbucksch commented 1 month ago

Version

v22.5.1

Platform

Linux mine 5.4.0-generic-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 20.04 focal
gcc/g++ 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)

Subsystem

node-gyp

What steps will reproduce the bug?

  1. Add better-sqlite, sqlite3 or another package that needs to be compiled (no precompiled modules)
  2. yarn install

How often does it reproduce? Is there a required condition?

Happens every time for me Did not happen on node v18 nor v20

What is the expected behavior? Why is that the expected behavior?

Compile works without errors

What do you see instead?

gyp http GET https://nodejs.org/download/release/v22.5.1/node-v22.5.1-headers.tar.gz gyp http 200 https://nodejs.org/download/release/v22.5.1/node-v22.5.1-headers.tar.gz gyp http GET https://nodejs.org/download/release/v22.5.1/SHASUMS256.txt gyp http 200 https://nodejs.org/download/release/v22.5.1/SHASUMS256.txt gyp ERR! UNCAUGHT EXCEPTION gyp ERR! stack TypeError: Cannot assign to read only property 'cflags' of object '#' gyp ERR! stack at createConfigFile (/src/dev/yarn/node_modules/node-gyp/lib/configure.js:118:21) gyp ERR! stack at /src/dev/yarn/node_modules/node-gyp/lib/configure.js:85:9 gyp ERR! stack at /src/dev/yarn/node_modules/mkdirp/index.js:30:20 gyp ERR! stack at FSReqCallback.oncomplete (node:fs:187:23) gyp ERR! System Linux 5.4.0-177-generic gyp ERR! command "/usr/local/bin/node" "/home/me/.yarn/bin/node-gyp" "rebuild" "--release" gyp ERR! cwd /src/myapp/node_modules/better-sqlite3 gyp ERR! node -v v22.5.1 gyp ERR! node-gyp -v v6.1.0 gyp ERR! This is a bug in node-gyp.

Additional information

Works in node v18.25.0 Works in node v20.15.1 Fails in node v22.5.1

RedYetiDev commented 1 month ago

Is it specific to yarn or can you reproduce with npm?