Skip to content

Commit fbf877a

Browse files
Fix Rust build by passing through RUSTUP_HOME variable (#14171)
While rebasing on the latest changes on `next`, especially #14160, I noticed that my local `pnpm build` step was no longer working and erring with the following: ``` │ > @tailwindcss/[email protected] build /Users/philipp/dev/tailwindcss/crates/node │ > npx napi build --platform --release --no-const-enum │ │ Type Error: Could not parse the Cargo.toml: Error: Command failed: cargo metadata --format-version 1 --manifest-path "/Users/philipp/dev/ │ tailwindcss/crates/node/Cargo.toml" │ error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured. │ help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain. │ │ error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured. │ help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain. ``` It turns out that with the changes in turbo v2, env variables no longer propagate to the individual tasks automatically but since I installed rustup outside of the default `~/.rustup` directory, the task was no longer able to find it. To fix this, we now define `RUSTUP_HOME` as a global env to always pass through.
1 parent 558dcd5 commit fbf877a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

crates/node/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
"access": "public"
4141
},
4242
"scripts": {
43-
"artifacts": "npx napi artifacts",
44-
"build": "npx napi build --platform --release --no-const-enum",
43+
"artifacts": "napi artifacts",
44+
"build": "napi build --platform --release --no-const-enum",
4545
"dev": "cargo watch --quiet --shell 'npm run build'",
46-
"build:debug": "npx napi build --platform --no-const-enum",
47-
"version": "npx napi version"
46+
"build:debug": "napi build --platform --no-const-enum",
47+
"version": "napi version"
4848
},
4949
"optionalDependencies": {
5050
"@tailwindcss/oxide-android-arm64": "workspace:*",

turbo.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@
4141
"cache": false,
4242
"persistent": true
4343
}
44-
}
44+
},
45+
// If rustup is installed outside of the default ~/.rustup directory, we need
46+
// to pass the path through to the individual rust tasks.
47+
"globalPassThroughEnv": ["RUSTUP_HOME"]
4548
}

0 commit comments

Comments
 (0)