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

Windows 10 / 11 : nw-gyp not running with anything past Node 14.x; NPM keeps trying to use node-gyp instead #157

Open
NbrTDB opened this issue Feb 16, 2023 · 0 comments

Comments

@NbrTDB
Copy link

NbrTDB commented Feb 16, 2023

This may be a more appropriate issue for the NPM repo, or perhaps NW.js... But I can't for the life of me get my NW.js project to build using any NW.js/Node combination that uses Node versions beyond Node 14 - it looks like nw-gyp is not running at all, instead the build process always tries to use node-gyp. It then explodes when node-gyp misinterprets the npm_config_target environment variable and starts trying to grab Node [whichever NW.js version was targeted here].

As soon as I switch back down to Node 14.x (say, 14.3.0, or 14.21.2) and try again, everything works perfectly, builds as expected, and my project is able to run. Interestingly, this is true up to NW.js 0.50.1, despite that theoretically wanting Node 15.3.0 for the build environment (if I actually try to use 15.3.0, the aforementioned issue with nw-gyp occurs).

My project does have various dependencies that require nw-gyp compilation (shown below, the package.json dependencies that are valid for Node up to 14.21.2 - the last version before Node 15):

  "dependencies": {
    "@serialport/parser-inter-byte-timeout": "^8.0.4",
    "JSONStream": "^1.3.5",
    "better-sqlite3": "7.4.6",
    "crc": "^3.8.0",
    "exceljs": "^4.3.0",
    "fs-extra": "^8.1.0",
    "fs-filesystem": "^2.1.2",
    "os": "^0.1.1",
    "serialport": "^8.0.4",
    "systeminformation": "^5.9.4",
    "usb-detection": "^4.10.0",
    "uuid": "^3.3.2",
    "xlsx": "^0.17.2"
  }

The build batchfile, at least the relevant parts, is essentially:

set PYTHON=C:\Python27\python.exe
set npm_config_target=0.50.1
set npm_config_arch=x64
set npm_config_runtime=node-webkit
set npm_config_build_from_source=true
set npm_config_node_gyp=%userprofile%\AppData\Roaming\npm\node_modules\nw-gyp\bin\nw-gyp.js

call npm install --msvs_version=2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant