nodejs / node-gyp

Node.js native addon build tool
MIT License
9.95k stars 1.8k forks source link

Windows+Node 22: `Cannot destructure property 'libUrl' of 'release[arch]' as it is undefined` #3071

Closed verhovsky closed 2 months ago

verhovsky commented 2 months ago

I get this error when I run prebuildify --napi --strip -- --arch x64 on Windows 2022 and Node 22. I can run the command successfully on macOS and Linux on Node 18, 20, 22 and on windows 2022 on Node 18 and 20.

https://github.com/tree-sitter/node-tree-sitter/actions/runs/10874583709/job/30172019914?pr=226

Verbose output (from npm or node-gyp): ``` Current runner version: '2.319.1' ##[group]Operating System Microsoft Windows Server 2022 10.0.20348 Datacenter ##[endgroup] ##[group]Runner Image Image: windows-2022 Version: 20240912.1.0 Included Software: https://github.com/actions/runner-images/blob/win22/20240912.1/images/windows/Windows2022-Readme.md Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20240912.1 ##[endgroup] ##[group]Runner Image Provisioner 2.0.384.1 ##[endgroup] ##[group]GITHUB_TOKEN Permissions Actions: read Attestations: read Checks: read Contents: read Deployments: read Discussions: read Issues: read Metadata: read Packages: read Pages: read PullRequests: read RepositoryProjects: read SecurityEvents: read Statuses: read ##[endgroup] Secret source: None Prepare workflow directory Prepare all required actions Getting action download info Download action repository 'actions/checkout@v4' (SHA:692973e3d937129bcbf40652eb9f2f61becf3332) Download action repository 'actions/setup-node@v4' (SHA:1e60f620b9541d16bece96c5465dc8ee9832be0b) Download action repository 'actions/upload-artifact@v4' (SHA:50769540e7f4bd5e21e526ee35c689e35e0d6874) Complete job name: Testing Node 22 on windows-2022 ##[group]Run actions/checkout@v4 with: submodules: true fetch-depth: 0 repository: tree-sitter/node-tree-sitter token: *** ssh-strict: true ssh-user: git persist-credentials: true clean: true sparse-checkout-cone-mode: true fetch-tags: false show-progress: true lfs: false set-safe-directory: true ##[endgroup] Syncing repository: tree-sitter/node-tree-sitter ##[group]Getting Git version info Working directory is 'D:\a\node-tree-sitter\node-tree-sitter' [command]"C:\Program Files\Git\bin\git.exe" version git version 2.46.0.windows.1 ##[endgroup] Temporarily overriding HOME='D:\a\_temp\4f899668-696e-4656-9ed3-e8c44cbb8776' before making global git config changes Adding repository directory to the temporary git global config as a safe directory [command]"C:\Program Files\Git\bin\git.exe" config --global --add safe.directory D:\a\node-tree-sitter\node-tree-sitter Deleting the contents of 'D:\a\node-tree-sitter\node-tree-sitter' ##[group]Initializing the repository [command]"C:\Program Files\Git\bin\git.exe" init D:\a\node-tree-sitter\node-tree-sitter Initialized empty Git repository in D:/a/node-tree-sitter/node-tree-sitter/.git/ [command]"C:\Program Files\Git\bin\git.exe" remote add origin https://github.com/tree-sitter/node-tree-sitter ##[endgroup] ##[group]Disabling automatic garbage collection [command]"C:\Program Files\Git\bin\git.exe" config --local gc.auto 0 ##[endgroup] ##[group]Setting up auth [command]"C:\Program Files\Git\bin\git.exe" config --local --name-only --get-regexp core\.sshCommand [command]"C:\Program Files\Git\bin\git.exe" submodule foreach --recursive "sh -c \"git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :\"" [command]"C:\Program Files\Git\bin\git.exe" config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader [command]"C:\Program Files\Git\bin\git.exe" submodule foreach --recursive "sh -c \"git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :\"" [command]"C:\Program Files\Git\bin\git.exe" config --local http.https://github.com/.extraheader "AUTHORIZATION: basic ***" ##[endgroup] ##[group]Fetching the repository [command]"C:\Program Files\Git\bin\git.exe" -c protocol.version=2 fetch --prune --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* +5cad1385090c8d3e00f7534ed58729de474b0d0c:refs/remotes/pull/226/merge From https://github.com/tree-sitter/node-tree-sitter * [new branch] align-wasm -> origin/align-wasm [...] * [new ref] 5cad1385090c8d3e00f7534ed58729de474b0d0c -> pull/226/merge ##[endgroup] ##[group]Determining the checkout info ##[endgroup] [command]"C:\Program Files\Git\bin\git.exe" sparse-checkout disable [command]"C:\Program Files\Git\bin\git.exe" config --local --unset-all extensions.worktreeConfig ##[group]Checking out the ref [command]"C:\Program Files\Git\bin\git.exe" checkout --progress --force refs/remotes/pull/226/merge Note: switching to 'refs/remotes/pull/226/merge'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at 5cad138 Merge 50afbae0be58e54db57cbeb32c35d4373d964c44 into 9ea6558f5e732abed81511c7966c88e8d6d06f24 ##[endgroup] ##[group]Setting up auth for fetching submodules [command]"C:\Program Files\Git\bin\git.exe" config --global http.https://github.com/.extraheader "AUTHORIZATION: basic ***" [command]"C:\Program Files\Git\bin\git.exe" config --global --unset-all url.https://github.com/.insteadOf [command]"C:\Program Files\Git\bin\git.exe" config --global --add url.https://github.com/.insteadOf git@github.com: [command]"C:\Program Files\Git\bin\git.exe" config --global --add url.https://github.com/.insteadOf org-17203512@github.com: ##[endgroup] ##[group]Fetching submodules [command]"C:\Program Files\Git\bin\git.exe" submodule sync [command]"C:\Program Files\Git\bin\git.exe" -c protocol.version=2 submodule update --init --force Submodule 'vendor/tree-sitter' (https://github.com/tree-sitter/tree-sitter.git) registered for path 'vendor/tree-sitter' Cloning into 'D:/a/node-tree-sitter/node-tree-sitter/vendor/tree-sitter'... Submodule path 'vendor/tree-sitter': checked out '62cd13a3defd7ca8319c98321d447c088407fbe5' [command]"C:\Program Files\Git\bin\git.exe" submodule foreach "git config --local gc.auto 0" Entering 'vendor/tree-sitter' ##[endgroup] ##[group]Persisting credentials for submodules [command]"C:\Program Files\Git\bin\git.exe" submodule foreach --recursive "sh -c \"git config --local --name-only --get-regexp 'url\.https\:\/\/github\.com\/\.insteadOf' && git config --local --unset-all 'url.https://github.com/.insteadOf' || :\"" Entering 'vendor/tree-sitter' [command]"C:\Program Files\Git\bin\git.exe" submodule foreach "sh -c \"git config --local 'http.https://github.com/.extraheader' 'AUTHORIZATION: basic ***' && git config --local --show-origin --name-only --get-regexp remote.origin.url\"" Entering 'vendor/tree-sitter' file:D:/a/node-tree-sitter/node-tree-sitter/.git/modules/vendor/tree-sitter/config remote.origin.url [command]"C:\Program Files\Git\bin\git.exe" submodule foreach "git config --local --add 'url.https://github.com/.insteadOf' 'git@github.com:'" Entering 'vendor/tree-sitter' [command]"C:\Program Files\Git\bin\git.exe" submodule foreach "git config --local --add 'url.https://github.com/.insteadOf' 'org-17203512@github.com:'" Entering 'vendor/tree-sitter' ##[endgroup] [command]"C:\Program Files\Git\bin\git.exe" log -1 --format='%H' '5cad1385090c8d3e00f7534ed58729de474b0d0c' ##[group]Run actions/setup-node@v4 with: node-version: 22 always-auth: false check-latest: false token: *** ##[endgroup] Attempting to download 22... Acquiring 22.8.0 - x64 from https://github.com/actions/node-versions/releases/download/22.8.0-10685632420/node-22.8.0-win32-x64.7z Extracting ... Adding to the cache ... ##[group]Environment details node: v22.8.0 npm: 10.8.2 yarn: 1.22.22 ##[endgroup] ##[group]Run npm install npm install shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'" ##[endgroup] npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported npm warn deprecated glob@8.1.0: Glob versions prior to v9 are no longer supported > tree-sitter@0.21.1 install > node-gyp-build gyp info it worked if it ends with ok gyp info using node-gyp@10.2.0 gyp info using node@22.8.0 | win32 | x64 gyp info find Python using Python version 3.12.6 found at "C:\hostedtoolcache\windows\Python\3.12.6\x64\python.exe" gyp http GET https://nodejs.org/download/release/v22.8.0/node-v22.8.0-headers.tar.gz gyp http 200 https://nodejs.org/download/release/v22.8.0/node-v22.8.0-headers.tar.gz gyp http GET https://nodejs.org/download/release/v22.8.0/SHASUMS256.txt gyp http GET https://nodejs.org/download/release/v22.8.0/win-x64/node.lib gyp http 200 https://nodejs.org/download/release/v22.8.0/SHASUMS256.txt gyp http 200 https://nodejs.org/download/release/v22.8.0/win-x64/node.lib gyp info find VS using VS2022 (17.11.35303.130) found at: gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" gyp info find VS run with --verbose for detailed information gyp info spawn C:\hostedtoolcache\windows\Python\3.12.6\x64\python.exe gyp info spawn args [ gyp info spawn args 'D:\\a\\node-tree-sitter\\node-tree-sitter\\node_modules\\node-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 '-I', gyp info spawn args 'D:\\a\\node-tree-sitter\\node-tree-sitter\\build\\config.gypi', gyp info spawn args '-I', gyp info spawn args 'D:\\a\\node-tree-sitter\\node-tree-sitter\\node_modules\\node-gyp\\addon.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\\Users\\runneradmin\\AppData\\Local\\node-gyp\\Cache\\22.8.0\\include\\node\\common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=C:\\Users\\runneradmin\\AppData\\Local\\node-gyp\\Cache\\22.8.0', gyp info spawn args '-Dnode_gyp_dir=D:\\a\\node-tree-sitter\\node-tree-sitter\\node_modules\\node-gyp', gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\runneradmin\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\22.8.0\\\\<(target_arch)\\\\node.lib', gyp info spawn args '-Dmodule_root_dir=D:\\a\\node-tree-sitter\\node-tree-sitter', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'D:\\a\\node-tree-sitter\\node-tree-sitter\\build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe gyp info spawn args [ gyp info spawn args 'build\\binding.sln', gyp info spawn args '/clp:Verbosity=minimal', gyp info spawn args '/nologo', gyp info spawn args '/p:Configuration=Release;Platform=x64' gyp info spawn args ] lib.c D:\a\node-tree-sitter\node-tree-sitter\vendor\tree-sitter\lib\src\query.c(3392,45): warning C4018: '>': signed/unsigned mismatch [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter.vcxproj] (compiling source file '../vendor/tree-sitter/lib/src/lib.c') win_delay_load_hook.cc tree_sitter.vcxproj -> D:\a\node-tree-sitter\node-tree-sitter\build\Release\\tree_sitter.lib cl : command line warning D9025: overriding '/std:c++20' with '/std:c++17' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] binding.cc cl : command line warning D9025: overriding '/std:c++20' with '/std:c++17' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] conversions.cc cl : command line warning D9025: overriding '/std:c++20' with '/std:c++17' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] language.cc cl : command line warning D9025: overriding '/std:c++20' with '/std:c++17' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] logger.cc cl : command line warning D9025: overriding '/std:c++20' with '/std:c++17' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] lookaheaditerator.cc cl : command line warning D9025: overriding '/std:c++20' with '/std:c++17' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] node.cc cl : command line warning D9025: overriding '/std:c++20' with '/std:c++17' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] parser.cc cl : command line warning D9025: overriding '/std:c++20' with '/std:c++17' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] query.cc cl : command line warning D9025: overriding '/std:c++20' with '/std:c++17' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] tree.cc cl : command line warning D9025: overriding '/std:c++20' with '/std:c++17' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] tree_cursor.cc cl : command line warning D9025: overriding '/std:c++20' with '/std:c++17' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] win_delay_load_hook.cc Creating library D:\a\node-tree-sitter\node-tree-sitter\build\Release\tree_sitter_runtime_binding.lib and object D:\a\node-tree-sitter\node-tree-sitter\build\Release\tree_sitter_runtime_binding.exp Generating code Previous IPDB not found, fall back to full compilation. All 1843 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. Finished generating code tree_sitter_runtime_binding.vcxproj -> D:\a\node-tree-sitter\node-tree-sitter\build\Release\\tree_sitter_runtime_binding.node gyp info ok added 440 packages, and audited 441 packages in 2m 59 packages are looking for funding run `npm fund` for details found 0 vulnerabilities ##[group]Run npm run build -- --arch x64 npm run build -- --arch x64 shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'" ##[endgroup] > tree-sitter@0.21.1 build > prebuildify --napi --strip x64 gyp info it worked if it ends with ok gyp info using node-gyp@10.2.0 gyp info using node@22.8.0 | win32 | x64 gyp info find Python using Python version 3.12.6 found at "C:\hostedtoolcache\windows\Python\3.12.6\x64\python.exe" gyp http GET https://nodejs.org/dist/v22.0.0/node-v22.0.0-headers.tar.gz gyp http 200 https://nodejs.org/dist/v22.0.0/node-v22.0.0-headers.tar.gz gyp http GET https://nodejs.org/dist/v22.0.0/SHASUMS256.txt gyp http 200 https://nodejs.org/dist/v22.0.0/SHASUMS256.txt gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack TypeError: Cannot destructure property 'libUrl' of 'release[arch]' as it is undefined. gyp ERR! stack at downloadNodeLib (D:\a\node-tree-sitter\node-tree-sitter\node_modules\node-gyp\lib\install.js:322:15) gyp ERR! stack at go (D:\a\node-tree-sitter\node-tree-sitter\node_modules\node-gyp\lib\install.js:263:20) gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:105:5) gyp ERR! stack at async install (D:\a\node-tree-sitter\node-tree-sitter\node_modules\node-gyp\lib\install.js:63:18) gyp ERR! stack at async getNodeDir (D:\a\node-tree-sitter\node-tree-sitter\node_modules\node-gyp\lib\configure.js:79:7) gyp ERR! stack at async run (D:\a\node-tree-sitter\node-tree-sitter\node_modules\node-gyp\bin\node-gyp.js:81:18) gyp ERR! System Windows_NT 10.0.20348 gyp ERR! command "C:\\hostedtoolcache\\windows\\node\\22.8.0\\x64\\node.exe" "D:\\a\\node-tree-sitter\\node-tree-sitter\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=22.0.0" "--devdir=C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\prebuildify\\node" "--arch=x64" "--release" gyp ERR! cwd D:\a\node-tree-sitter\node-tree-sitter\x64 gyp ERR! node -v v22.8.0 gyp ERR! node-gyp -v v10.2.0 gyp ERR! not ok node-gyp exited with 1 ##[error]Process completed with exit code 1. Post job cleanup. [command]"C:\Program Files\Git\bin\git.exe" version git version 2.46.0.windows.1 Temporarily overriding HOME='D:\a\_temp\570748c4-d606-445a-897b-c7ec957d45d6' before making global git config changes Adding repository directory to the temporary git global config as a safe directory [command]"C:\Program Files\Git\bin\git.exe" config --global --add safe.directory D:\a\node-tree-sitter\node-tree-sitter [command]"C:\Program Files\Git\bin\git.exe" config --local --name-only --get-regexp core\.sshCommand [command]"C:\Program Files\Git\bin\git.exe" submodule foreach --recursive "sh -c \"git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :\"" Entering 'vendor/tree-sitter' [command]"C:\Program Files\Git\bin\git.exe" config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader http.https://github.com/.extraheader [command]"C:\Program Files\Git\bin\git.exe" config --local --unset-all http.https://github.com/.extraheader [command]"C:\Program Files\Git\bin\git.exe" submodule foreach --recursive "sh -c \"git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :\"" Entering 'vendor/tree-sitter' http.https://github.com/.extraheader Cleaning up orphan processes Terminate orphan process: pid (800) (vctip) ```
StefanStojanovic commented 2 months ago

Let me start by saying I never used prebuildify before, thus have no idea what it is used for etc.

OK, now that's out of the way, you say you were running prebuildify --napi --strip -- --arch x64 and that is the case for Node v18 and v20 jobs. However, for v22, the command you run (found in the attached log) is prebuildify --napi --strip x64. I do not know if missing --arch is an issue, but it could be, especially given the error node-gyp reports.

EDIT: What I meant is the log for that step differs on Windows + Node.js v22, compared to other OS/Node combinations

verhovsky commented 2 months ago

Thank you, I didn't notice that. This must be some sort of GitHub Actions issue