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

getting a error when i run npm install --legacy-peer-deps #166

Closed
binary-blazer opened this issue Apr 26, 2023 · 4 comments
Closed

getting a error when i run npm install --legacy-peer-deps #166

binary-blazer opened this issue Apr 26, 2023 · 4 comments
Assignees
Labels

Comments

@binary-blazer
Copy link

binary-blazer commented Apr 26, 2023

Hello! When i run the npm install --legacy-peer-deps command it seems to try to install the npm packages defined in the package.json file. But it ends in a error and the error message includes the node-re2 package so im asking if you guys can help me. the error is below:

npm ERR! code 1
npm ERR! path C:\Users\janjy\OneDrive\Desktop\GiveAways API\node_modules\re2
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR
npm ERR! Trying https://github.com/uhop/node-re2/releases/download/1.15.4/win32-x64-115.br ...
npm ERR! Trying https://github.com/uhop/node-re2/releases/download/1.15.4/win32-x64-115.gz ...
npm ERR! Building locally ...
npm ERR!
npm ERR! > re2@1.15.4 rebuild
npm ERR! > node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@20.0.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.11.3 found at "C:\Python311\python.exe"
npm ERR! gyp info find VS using VS2019 (16.11.33529.622) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp ERR! UNCAUGHT EXCEPTION
npm ERR! gyp ERR! stack TypeError: Cannot assign to read only property 'cflags' of object '#<Object>'
npm ERR! gyp ERR! stack     at createConfigFile (C:\Users\janjy\OneDrive\Desktop\GiveAways API\node_modules\node-gyp\lib\configure.js:117:21)
npm ERR! gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
npm ERR! gyp ERR! System Windows_NT 10.0.22621
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\janjy\\OneDrive\\Desktop\\GiveAways API\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\janjy\OneDrive\Desktop\GiveAways API\node_modules\re2
npm ERR! gyp ERR! node -v v20.0.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! Node-gyp failed to build your package.
npm ERR! gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.
npm ERR! node:internal/process/promises:289
npm ERR!             triggerUncaughtException(err, true /* fromPromise */);
npm ERR!             ^
npm ERR!
npm ERR! [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "7".] {
npm ERR!   code: 'ERR_UNHANDLED_REJECTION'
npm ERR! }
npm ERR!
npm ERR! Node.js v20.0.0

npm ERR! A complete log of this run can be found in: C:\Users\janjy\AppData\Local\npm-cache\_logs\2023-04-26T12_34_19_805Z-debug-0.log
@uhop uhop self-assigned this Apr 27, 2023
@uhop uhop added the bug A reported bug. label Apr 27, 2023
@uhop
Copy link
Owner

uhop commented Apr 27, 2023

As far as I can tell you are trying to compile re2 on Node 20 and getting an error from node-gyp, which is a required dependency of any binary node extension:

npm ERR! gyp ERR! stack TypeError: Cannot assign to read only property 'cflags' of object '#<Object>'
npm ERR! gyp ERR! stack     at createConfigFile (C:\Users\janjy\OneDrive\Desktop\GiveAways API\node_modules\node-gyp\lib\configure.js:117:21)
npm ERR! gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

It is likely node-gyp installed on that computer is too old and does not support Node 20:

npm ERR! gyp ERR! node -v v20.0.0
npm ERR! gyp ERR! node-gyp -v v7.1.2

The current version at the time of this writing is 9.3.1 (see https://www.npmjs.com/package/node-gyp).

Another possible concern can be the version of VS:

npm ERR! gyp info find VS using VS2019 (16.11.33529.622) found at:

My advice would be to update other related software when upgrading Node. Generally node-gyp should explicitly support a Node version because APIs and corresponding C++ headers change with every version.

@binary-blazer
Copy link
Author

So i tried to update my node-gyp to the latest version now, the error did not got fixed and the version of VS is the latest and i already tried to repair it with the "Repair Visual Studio" button.

What should i do now? Should i try to downgrade to nodejs v18?

@uhop
Copy link
Owner

uhop commented May 25, 2023

I don't really know. Every time I commit a Github action builds the project on all supported platforms and run tests. To wit: https://github.com/uhop/node-re2/actions/runs/5082834983

You can inspect the command-line output of any job — they usually print out their exact configuration. You can see how it is different with your setup.

@uhop uhop added question and removed bug A reported bug. labels May 25, 2023
@binary-blazer
Copy link
Author

I got it. It was a issue with a npm package i had in my package.json. im still wondering why this Error happened now because im using this package since i think 1 year and i never had issues. I removed the package and after that it installed everything without any issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants