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

nw-gyp failed with node 19.0.1 #155

Open
onemen opened this issue Nov 6, 2022 · 7 comments
Open

nw-gyp failed with node 19.0.1 #155

onemen opened this issue Nov 6, 2022 · 7 comments

Comments

@onemen
Copy link

onemen commented Nov 6, 2022

When I'm running node 19.0.1 on windows 11 (nw-gyp -v v3.6.6)

The command nw-gyp configure --release --target=0.70.1 --arch=x64 --python="c:/python2.7/python.exe" failed with error:
gyp: Undefined variable standalone_static_library in binding.gyp while trying to load binding.gyp

same result when running nw-gyp rebuild.

When i run the same command with node 18.12.1 it work.

binding.gyp:

{
  "targets": [
    {
      "target_name": "cityhash",
      "sources": [ "binding.cc", "mozilla/cityhash/city.cpp" ]
    }
  ]
}

console output:

gyp info it worked if it ends with ok
gyp info using nw-gyp@3.6.6
gyp info using node@19.0.1 | win32 | x64
gyp info find VS using VS2022 (17.3.32929.385) found at:
gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python27\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\USER_NAME\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\nw-gyp@3.6.6\\node_modules\\nw-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\USER_NAME\\projects\\testing\\installer\\src\\cityhash\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\USER_NAME\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\nw-gyp@3.6.6\\node_modules\\nw-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\USER_NAME\\.nw-gyp\\0.70.1\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\USER_NAME\\.nw-gyp\\0.70.1',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\USER_NAME\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\nw-gyp@3.6.6\\node_modules\\nw-gyp',
gyp info spawn args   '-Dnode_lib_file="C:\\Users\\USER_NAME\\.nw-gyp\\0.70.1\\<(target_arch)\\node.lib"',
gyp info spawn args   '-Dnw_lib_file="C:\\Users\\USER_NAME\\.nw-gyp\\0.70.1\\<(target_arch)\\nw.lib"',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\USER_NAME\\projects\\testing\\installer\\src\\cityhash',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '-Dv13=1',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\USER_NAME\\projects\\testing\\installer\\src\\cityhash\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: Undefined variable standalone_static_library in binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\USER_NAME\AppData\Local\pnpm\global\5\.pnpm\nw-gyp@3.6.6\node_modules\nw-gyp\lib\configure.js:367:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Windows_NT 10.0.22621
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\USER_NAME\\AppData\\Local\\pnpm\\global\\5\\node_modules\\nw-gyp\\bin\\nw-gyp.js" "configure" "--release" "--target=0.70.1" "--arch=x64" "--python=c:/python2.7/python.exe"
gyp ERR! cwd C:\Users\USER_NAME\projects\testing\installer\src\cityhash
gyp ERR! node -v v19.0.1
gyp ERR! nw-gyp -v v3.6.6
gyp ERR! not ok
@secribeiro
Copy link

node 19.0.0 has been changed to make process.config read only #43627 and nw-gyp uses process.config and change it to create config.gypi in lib/configure.js

You need to change lib/configure.js file, line 118 to clone process.config object
var config = process.config || {}
to
var config = JSON.parse(JSON.stringify(process.config)) || {}

After that you can compile your module with nw-gyp

@onemen
Copy link
Author

onemen commented Nov 9, 2022

Thank you @secribeiro it work 👍

@aldrienht
Copy link

Hi @secribeiro @onemen , i tried to update lib/configure.js as suggested above but running yarn install reverted it and issue shows in console again.

@onemen
Copy link
Author

onemen commented Jun 8, 2023

Try node 20

@aldrienht
Copy link

Hi @onemen - currently using node v20.2.0
I post a question on StackOverflow - here

@onemen
Copy link
Author

onemen commented Jun 9, 2023

@aldrienht,

I am not using Yarn, so i can not test it, but try to modify lib/configure.js after yarn install

@theredpea
Copy link

Is this fixed by #160 ?

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

4 participants