Skip to content

build,win: fail fast in vcbuild without cargo - #66858

Open
vedchaudhari wants to merge 1 commit into
nodejs:mainfrom
vedchaudhari:build-vcbuild-cargo-check
Open

vedchaudhari wants to merge 1 commit into
nodejs:mainfrom
vedchaudhari:build-vcbuild-cargo-check

Conversation

@vedchaudhari

Copy link
Copy Markdown
Contributor

If Rust isn't installed, vcbuild.bat doesn't catch it. The build runs for a long time and then fails with:

error MSB8066: Custom build for 'Cargo.toml' exited with code 1. [...\deps\crates\node_crates.vcxproj]

There's already a cargo/rustc check in configure.py, but on Windows check_compiler() returns before it gets there (L1630-L1646, L1670-L1690), so Temporal stays on and cargo_build.py fails when it tries to run cargo.

This adds a small tools/msvs/find_cargo.cmd (similar to find_nasm.cmd) and calls it from vcbuild.bat. It looks for cargo the same way cargo_build.py does: CARGO, then PATH, then %USERPROFILE%\.cargo\bin. Without Rust, the build now stops right away:

Looking for cargo
Could not find cargo, install the Rust toolchain. See BUILDING.md.

The check is skipped for nobuild, clean, and when --v8-disable-temporal-support or --shared-temporal_capi is passed, same as configure.py.

Tested on Windows 11 with and without Rust on PATH, with CARGO set to a full path, and with rustup in %USERPROFILE%\.cargo\bin.

Note : it only checks that cargo exists, not rustc or the versions (configure.py only warns about old versions on other platforms). Also, BUILDING.md says a missing cargo disables Temporal, which isn't the case on Windows. I can fix that in a follow-up.

Fixes: #66848
Refs: #63451

Assisted-by: Claude Code. I reproduced the issue, reviewed the change, and tested it with and without Rust on PATH myself.

On Windows, configure.py returns from check_compiler() before it gets
to the cargo and rustc check, so Temporal stays enabled even when no
Rust toolchain is installed. The build then runs for a long time and
fails in node_crates.vcxproj with MSB8066.

Check for cargo in vcbuild.bat before configuring and building, in the
same places deps/crates/cargo_build.py looks, and stop with a message
pointing to BUILDING.md. The check is skipped for nobuild, clean, and
when Temporal is disabled or provided as a shared library.

Assisted-by: a closed-source coding agent
Signed-off-by: vedchaudhari <vedc2853@gmail.com>
@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to Node.js builds or CI infrastructure. install Issues and PRs related to installing Node.js and its installers. needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. windows Issues and PRs related to the Windows platform. labels Oct 19, 2026

@MikeMcC399 MikeMcC399 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vedchaudhari !

I cross-checked against my original issue #66848

Rust Toolchain installed

I checked with the following installed on Windows 11 26H2, running .\vcbuild.bat in PowerShell:

  • rustc 1.99.1
  • cargo 1.99.1

build and smoke-test were successful.

Release\node -e "console.log('Hello from Node.js', process.version)"
Hello from Node.js v27.0.0-pre

Rust Toolchain uninstalled

Executing rustup self uninstall (uninstalls rustc & cargo), confirms fast failure:

 .\vcbuild.bat
Looking for Python
Python found in C:\Users\mikem\AppData\Local\Microsoft\WindowsApps\\python.exe
Python 3.15.0
Looking for NASM
Looking for cargo
Could not find cargo, install the Rust toolchain. See BUILDING.md.

@MikeMcC399 MikeMcC399 added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 20, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 20, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@MikeMcC399 MikeMcC399 added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. labels Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. build Issues and PRs related to Node.js builds or CI infrastructure. commit-queue PRs queued for automated landing through the Commit Queue. install Issues and PRs related to installing Node.js and its installers. needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. windows Issues and PRs related to the Windows platform.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build from source on Windows - vcbuild does not prevent failed build attempt without Rust toolchain

4 participants