Make ncc compatible with Node.js 24
What would you like?
Provide @vercel/ncc with tested compatibility against Node.js 24 for macOS, Ubuntu and 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_modulesdirectory 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:
-
node20for Node.js v20. -
node24for Node.js v24.
Currently .github/workflows/ci.yml tests against Node.js 18 and 20. It does not test against other supported Node.js release lines Node.js 22, 24 and 25.
Other
Attempting to simply update .github/workflows/ci.yml to cover Node.js 22 and 24 failed when testing against windows-latest. Failures were related to node-gyp compatibility.
Logs
Running .github/workflows/ci.yml, extended to test against Node.js 24 results in the following failure logs in the job "Install Dependencies" on windows-latest. (The logs for Node.js 22 look very similar as well.)
Run yarn global add node-gyp && yarn install --frozen-lockfile
yarn global v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
- node-gyp
Done in 12.28s.
yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
error D:\a\ncc\ncc\node_modules\canvas: Command failed.
Exit code: 1
Command: prebuild-install -r napi || node-gyp rebuild
Arguments:
Directory: D:\a\ncc\ncc\node_modules\canvas
Output:
prebuild-install warn This package does not support N-API version undefined
(node:1268) [DEP0176] DeprecationWarning: fs.R_OK is deprecated, use fs.constants.R_OK instead
(Use `node --trace-deprecation ...` to show where the warning was created)
prebuild-install warn install No prebuilt binaries found (target=undefined runtime=napi arch=x64 libc= platform=win32)
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.14.0 found at "C:\hostedtoolcache\windows\Python\3.14.0\x64\python.exe"
gyp http GET https://nodejs.org/download/release/v24.11.0/node-v24.11.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v24.11.0/node-v24.11.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v24.11.0/SHASUMS256.txt
gyp http GET https://nodejs.org/download/release/v24.11.0/win-x64/node.lib
gyp http 200 https://nodejs.org/download/release/v24.11.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v24.11.0/win-x64/node.lib
gyp info find VS using VS2022 (17.14.36616.10) 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.14.0\x64\python.exe
gyp info spawn args [
gyp info spawn args 'C:\\Users\\runneradmin\\AppData\\Local\\Yarn\\Data\\global\\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\\node_modules\\canvas\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\runneradmin\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\runneradmin\\AppData\\Local\\node-gyp\\Cache\\24.11.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.11.0',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\runneradmin\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\runneradmin\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\24.11.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args '-Dmodule_root_dir=D:\\a\\ncc\\ncc\\node_modules\\canvas',
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\\node_modules\\canvas\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
Warning: Missing input files:
C:\GTK\bin\libpangocairo-1.0-0.dll
C:\GTK\bin\libintl-8.dll
C:\GTK\bin\libglib-2.0-0.dll
C:\GTK\bin\libgmodule-2.0-0.dll
C:\GTK\bin\libexpat-1.dll
C:\GTK\bin\libpng14-14.dll
C:\GTK\bin\libgobject-2.0-0.dll
C:\GTK\bin\libfreetype-6.dll
C:\GTK\bin\libpangowin32-1.0-0.dll
C:\GTK\bin\zlib1.dll
C:\GTK\bin\libpango-1.0-0.dll
C:\GTK\bin\libfontconfig-1.dll
C:\GTK\bin\libgthread-2.0-0.dll
C:\GTK\bin\libcairo-2.dll
C:\GTK\bin\libpangoft2-1.0-0.dll
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 '/nodeReuse:false',
gyp info spawn args '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Backend.cc
D:\a\ncc\ncc\node_modules\canvas\src\backend\Backend.h(3,10): error C1083: Cannot open include file: 'cairo.h': No such file or directory [D:\a\ncc\ncc\node_modules\canvas\build\canvas.vcxproj]
(compiling source file '../src/backend/Backend.cc')
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.<anonymous> (C:\Users\runneradmin\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\build.js:219: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.11.0\\x64\\node.exe" "C:\\Users\\runneradmin\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\a\ncc\ncc\node_modules\canvas
gyp ERR! node -v v24.11.0
gyp ERR! node-gyp -v v11.5.0
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Process completed with exit code 1.