Skip to content

Make ncc compatible with Node.js 24 for Windows (Rev2) #1308

@MikeMcC399

Description

@MikeMcC399

Follows on from #1297

What would you like?

Provide @vercel/ncc with tested compatibility against Node.js 24 for Windows

Why is this needed?

In the GitHub documentation Creating a JavaScript action, section Commit, tag, and push your action, it says:

Checking in your node_modules directory can cause problems. As an alternative, you can use tools such as rollup.js or @vercel/ncc to combine your code and dependencies into one file for distribution.

GitHub Actions runs.using for JavaScript actions provides for:

  • node20 for Node.js v20.
  • node24 for Node.js v24.

GitHub has deprecated the use of node20 and plans to force runners to use node24 beginning on Mar 4 Jun 2, 2026 - see Deprecation of Node 20 on GitHub Actions runners.

Currently .github/workflows/ci.yml tests against Node.js 20 and 22. It does not test against other supported Node.js release lines Node.js 24 and 25.

Other

Extending the .github/workflows/ci.yml workflow to test Node.js 24 and 24 and running it shows:

Node.js macOS Ubuntu Windows
20.20.0 pass pass pass
22.22.0 pass pass pass
24.13.1 pass pass fail
25.7.0 fail fail fail

with failures testing against windows-latest for Node.js 24, and failures in all operating systems (ubuntu-latest, macos-latest and windows-latest) for Node.js 25.

Failures were related to node-gyp / C++20 compatibility.


Logs Node.js 24 & Windows

Running .github/workflows/ci.yml, extended to test against Node.js 24 results in the following failure logs in the job "Build Test Binary" on windows-latest.

Run yarn build-test-binary
yarn run v1.22.22
$ cd test/binary && node-gyp rebuild && cp build/Release/hello.node ../integration/hello.node
gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.1
gyp info using node@24.14.0 | win32 | x64
(node:7560) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:7560) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(node:7560) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
gyp info find Python using Python version 3.11.9 found at "C:\hostedtoolcache\windows\Python\3.11.9\x64\python3.exe"
gyp info find VS using VS2022 (17.14.37012.4) 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.11.9\x64\python3.exe
gyp info spawn args [
gyp info spawn args   'D:\\a\\ncc\\ncc\\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\\ncc\\ncc\\test\\binary\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\a\\ncc\\ncc\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\runneradmin\\AppData\\Local\\node-gyp\\Cache\\24.14.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\\24.14.0',
gyp info spawn args   '-Dnode_gyp_dir=D:\\a\\ncc\\ncc\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\runneradmin\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\24.14.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\a\\ncc\\ncc\\test\\binary',
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\\ncc\\ncc\\test\\binary\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Warning: unrecognized setting VCCLCompilerTool/LanguageStandard while converting to MSBuild.
Warning: unrecognized setting VCCLCompilerTool/LanguageStandard_C while converting to MSBuild.
Warning: unrecognized setting VCCLCompilerTool/LanguageStandard while converting to MSBuild.
Warning: unrecognized setting VCCLCompilerTool/LanguageStandard_C while converting to MSBuild.
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 ]

  In file included from ..\hello.cc:2:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\node.h:74:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8.h:23:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\cppgc/common.h:8:
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8config.h(13,2): error : "C++20 or later required." [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
  In file included from ..\hello.cc:2:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\node.h:74:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8.h:24:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-array-buffer.h:12:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h:13:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-handle-base.h:8:
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(128,72): warning : 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(142,71): warning : 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(346,38): warning : 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(480,72): warning : 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(780,42): warning : 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(781,45): warning : 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1065,25): error : no template named 'optional' in namespace 'std' [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1256,37): error : a non-type template parameter cannot have type 'ExternalPointerTagRange' (aka 'TagRange<ExternalPointerTag>') before C++20 [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1067,14): warning : braces around scalar initializer [-Wbraced-scalar-init] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1114,61): warning : 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1115,55): warning : 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1116,63): warning : 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1386,1): warning : inline variables are a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1388,1): warning : inline variables are a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1392,1): warning : inline variables are a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1394,1): warning : inline variables are a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1436,72): warning : 'static_assert' with no message is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1469,8): warning : constexpr if is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-internal.h(1628,51): warning : template template parameter using 'typename' is a C++17 extension [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
  In file included from ..\hello.cc:2:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\node.h:74:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8.h:24:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-array-buffer.h:12:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h:13:
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-handle-base.h(10,13): warning : nested namespace definition is a C++17 extension; define each namespace separately [-Wc++17-extensions] [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
  In file included from ..\hello.cc:2:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\node.h:74:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8.h:24:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-array-buffer.h:12:
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h(280,5): error : unknown type name 'requires' [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h(280,19): error : non-friend class member 'is_base_of_v' cannot have a qualified name [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h(280,19): error : member 'is_base_of_v' declared as a template [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h(280,19): error : variable template partial specialization of 'is_base_of_v' not in a namespace enclosing 'std' [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\type_traits(1257,16): message : explicitly specialized declaration is here [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
  In file included from ..\hello.cc:2:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\node.h:74:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8.h:24:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-array-buffer.h:12:
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h(280,37): error : expected ';' at end of declaration list [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h(645,5): error : unknown type name 'requires' [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h(645,19): error : non-friend class member 'is_base_of_v' cannot have a qualified name [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h(645,19): error : member 'is_base_of_v' declared as a template [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h(645,19): error : variable template partial specialization of 'is_base_of_v' not in a namespace enclosing 'std' [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\type_traits(1257,16): message : explicitly specialized declaration is here [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
  In file included from ..\hello.cc:2:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\node.h:74:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8.h:24:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-array-buffer.h:12:
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-local-handle.h(645,37): error : expected ';' at end of declaration list [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
  In file included from ..\hello.cc:2:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\node.h:74:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8.h:24:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-array-buffer.h:13:
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-memory-span.h(45,28): error : no member named 'ranges' in namespace 'std' [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-memory-span.h(47,28): error : no member named 'ranges' in namespace 'std' [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-memory-span.h(168,35): error : no type named 'contiguous_iterator_tag' in namespace 'std'; did you mean 'output_iterator_tag'? [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\__msvc_iter_core.hpp(42,20): message : 'output_iterator_tag' declared here [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
  In file included from ..\hello.cc:2:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\node.h:74:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8.h:24:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-array-buffer.h:14:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-object.h:10:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\v8-maybe.h:11:
  In file included from C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\cppgc/internal/conditional-stack-allocated.h:10:
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\cppgc/macros.h(51,1): error : unknown type name 'concept' [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\cppgc/macros.h(52,5): error : use of undeclared identifier 'requires' [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
C:\Users\runneradmin\AppData\Local\node-gyp\Cache\24.14.0\include\node\cppgc/macros.h(52,13): error : expected ';' after top level declarator [D:\a\ncc\ncc\test\binary\build\hello.vcxproj]
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\a\ncc\ncc\node_modules\node-gyp\lib\build.js:203:23)
gyp ERR! stack     at ChildProcess.emit (node:events:508:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Windows_NT 10.0.26100
gyp ERR! command "C:\\hostedtoolcache\\windows\\node\\24.14.0\\x64\\node.exe" "D:\\a\\ncc\\ncc\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\a\ncc\ncc\test\binary
gyp ERR! node -v v24.14.0
gyp ERR! node-gyp -v v9.4.1
gyp ERR! not ok
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions