Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot assign to read only property 'cflags' of object '#<Object>' #2752

Closed
guanzhengyinqin opened this issue Oct 27, 2022 · 8 comments
Closed
Labels
ffi-napi Node Sass --> Dart Sass https://github.com/sass/node-sass/issues/2952

Comments

@guanzhengyinqin
Copy link

guanzhengyinqin commented Oct 27, 2022

build node-sass error

c++ compiler
gcc -E -dM - </dev/null | grep "STDC_VERSION"
#define STDC_VERSION 201710L

details
npm --verbose
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli '/usr/bin/node',
gyp verb cli '/home/guanzheng/document/workspace/codeworkspace/webstormProject/Saber/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@7.1.2
gyp info using node@19.0.0 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
gyp verb find Python - executable path is "/usr/bin/python3"
gyp verb find Python - executing "/usr/bin/python3" to get version
gyp verb find Python - version is "3.10.8"
gyp info find Python using Python version 3.10.8 found at "/usr/bin/python3"
gyp verb get node dir no --target version specified, falling back to host node version: 19.0.0
gyp verb command install [ '19.0.0' ]
gyp verb install input version string "19.0.0"
gyp verb install installing version: 19.0.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 19.0.0
gyp verb build dir attempting to create "build" dir: /home/guanzheng/document/workspace/codeworkspace/webstormProject/Saber/node_modules/node-sass/build
gyp verb build dir "build" dir needed to be created? /home/guanzheng/document/workspace/codeworkspace/webstormProject/Saber/node_modules/node-sass/build
gyp verb build/config.gypi creating config file
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack TypeError: Cannot assign to read only property 'cflags' of object '#'
gyp ERR! stack at createConfigFile (/home/guanzheng/document/workspace/codeworkspace/webstormProject/Saber/node_modules/node-sass/node_modules/node-gyp/lib/configure.js:117:21)
gyp ERR! stack at /home/guanzheng/document/workspace/codeworkspace/webstormProject/Saber/node_modules/node-sass/node_modules/node-gyp/lib/configure.js:84:9
gyp ERR! stack at FSReqCallback.oncomplete (node:fs:189:23)
gyp ERR! System Linux 6.0.2-arch1-1
gyp ERR! command "/usr/bin/node" "/home/guanzheng/document/workspace/codeworkspace/webstormProject/Saber/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/guanzheng/document/workspace/codeworkspace/webstormProject/Saber/node_modules/node-sass
gyp ERR! node -v v19.0.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! Node-gyp failed to build your package.

@cclauss
Copy link
Contributor

cclauss commented Oct 27, 2022

Here is the text that you deleted when you opened this issue...

Please look thru your error log for the string gyp info using node-gyp@ and if the version number is less than the current release of node-gyp then please upgrade using the instructions at https://github.com/nodejs/node-gyp/blob/master/docs/Updating-npm-bundled-node-gyp.md and try your command again.

Requests for help with node-sass are very common. Please be aware that this package is deprecated, you should seek alternatives and avoid opening new issues about it here.

@cclauss cclauss closed this as completed Oct 27, 2022
@Jakobeha
Copy link

Note the above instructions don't work in npm 9. What did work and force nodejs to use the correct node-gyp version was adding it to devDependencies as described here

@alper
Copy link

alper commented Sep 14, 2023

This is a relatively old project. I'm not sure how randomly upgrading node-gyp will solve it and not break a bunch of other things.

gyp info using node-gyp@5.0.7
gyp info using node@20.6.1 | darwin | arm64

@cclauss cclauss added the Node Sass --> Dart Sass https://github.com/sass/node-sass/issues/2952 label Sep 14, 2023
@cclauss
Copy link
Contributor

cclauss commented Sep 14, 2023

@alper
Copy link

alper commented Sep 14, 2023

I can't upgrade it because it's not one of our main dependencies. Some other package is depending on it.

@xzifan
Copy link

xzifan commented Dec 13, 2023

I was trying to rebuild ref-napi and ffi-napi for electron and the same error showed up.

Adding "node-gyp": "^10.0.1" to devDependencies fixed it in my case.

@cclauss
Copy link
Contributor

cclauss commented Dec 19, 2023

@kapilshanaz
Copy link

kapilshanaz commented Jan 6, 2024

Adding dev dependencies
"node-gyp": "10.0.1", "nan": "2.18.0"
Also adding
"resolutions": { "nan": "2.18.0" }
to package.json worked for me for Node.JS 20 build failure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ffi-napi Node Sass --> Dart Sass https://github.com/sass/node-sass/issues/2952
Projects
None yet
Development

No branches or pull requests

6 participants