# Complex Build (Rust + JS)

**URL:** <https://answers.netlify.com/t/complex-build-rust-js/159131>\
**Category:** Support\
**Tags:** building\
**Created:** [January 14, 2026, 12:57pm UTC](https://answers.netlify.com/t/complex-build-rust-js/159131 "2026-01-14T12:57:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dougalg](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dougalg/32/76418_2.png) [@dougalg](https://answers.netlify.com/u/dougalg)\
**Post date:** [January 14, 2026, 12:57pm UTC](https://answers.netlify.com/t/complex-build-rust-js/159131/1 "2026-01-14T12:57:38Z")

</div>

Site name: astonishing-muffin-30b635.netlify.app

I am attempting to build an app that requires building first a rust WASM portion using wasm-pack, and then a vue webapp.

What is the normal process to do something like this? In a normal CLI it woud look something like:

```auto
cargo install wasm-pack
yarn wasm
yarn build

```

Logs:

```auto
7:41:51 PM: $ rustup default stable & cargo install wasm-pack & yarn wasm & yarn build
7:41:51 PM: info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
7:41:51 PM: 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.
7:41:51 PM: info: latest update on 2025-12-11, rust version 1.92.0 (ded5c06cf 2025-12-08)
7:41:51 PM: info: downloading component 'cargo'
7:41:51 PM: yarn run v1.22.22
7:41:51 PM: warning package.json: No license field
7:41:51 PM: $ vite build
7:41:51 PM: yarn run v1.22.22
7:41:51 PM: warning package.json: No license field
7:41:51 PM: $ wasm-pack build ./key_bnc_wasm --target web
7:41:51 PM: /bin/sh: 1: wasm-pack: not found
7:41:51 PM: error Command failed with exit code 127. (https://ntl.fyi/exit-code-127)
7:41:51 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
7:41:51 PM: info: downloading component 'clippy'
7:41:51 PM: info: downloading component 'rust-docs'
7:41:51 PM: info: downloading component 'rust-std'
7:41:51 PM: info: downloading component 'rustc'
7:41:52 PM: vite v2.6.10 building for production...
7:41:52 PM: Error: Can't find key_bnc_wasm/pkg, run wasm-pack build ./key_bnc_wasm --target web first
✓ 0 modules transformed.

```

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [January 14, 2026, 5:46pm UTC](https://answers.netlify.com/t/complex-build-rust-js/159131/2 "2026-01-14T17:46:34Z")

</div>

Have you tried:

```auto
rustup default stable && cargo install wasm-pack && wasm-pack build ./key_bnc_wasm --target web

```

Seems to be working for me.

---

<div class="post-metadata">

**Author:** ![dougalg](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dougalg/32/76418_2.png) [@dougalg](https://answers.netlify.com/u/dougalg)\
**Post date:** [January 15, 2026, 5:23am UTC](https://answers.netlify.com/t/complex-build-rust-js/159131/3 "2026-01-15T05:23:11Z")

</div>

Thank you! `rustup default stable` was the missing link

---

<div class="post-metadata">

**Author:** ![talves](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/talves/32/101_2.png) [@talves](https://answers.netlify.com/u/talves)\
**Post date:** [January 16, 2026, 7:41pm UTC](https://answers.netlify.com/t/complex-build-rust-js/159131/4 "2026-01-16T19:41:12Z")

</div>

Another option is to use the `rust-toolchain` file. It should tell cargo to use the toolchain channel you specify. In the case of OP it would be stable.

---

<div class="post-metadata">

**Author:** ![dougalg](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dougalg/32/76418_2.png) [@dougalg](https://answers.netlify.com/u/dougalg)\
**Post date:** [January 17, 2026, 3:36am UTC](https://answers.netlify.com/t/complex-build-rust-js/159131/5 "2026-01-17T03:36:46Z")

</div>

You know what’s weird? I ended needing to use `rustup toolchain install 1.78.0` and it was working fine.

But I just pushed a branch with some simple CSS changes, and now it has stopped working. It’s giving me the following error:

```auto
10:23:27 AM: $ rustup toolchain install 1.78.0 && cargo install wasm-pack --version=0.10.1 --locked && pnpm wasm && pnpm build
10:23:28 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
10:23:28 AM: info: syncing channel updates for '1.78.0-x86_64-unknown-linux-gnu'
10:23:28 AM: 1.78.0-x86_64-unknown-linux-gnu unchanged - rustc 1.78.0 (9b00956e5 2024-04-29)
10:23:28 AM: 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.

```

---

<div class="post-metadata">

**Author:** ![dougalg](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dougalg/32/76418_2.png) [@dougalg](https://answers.netlify.com/u/dougalg)\
**Post date:** [January 17, 2026, 3:41am UTC](https://answers.netlify.com/t/complex-build-rust-js/159131/6 "2026-01-17T03:41:59Z")

</div>

After putting a `rust-toolchain.toml` in the root, and removing the explicit `rustup` command, the latest run seems to have built fine. I still don’t know what’s up with the flakiness, though.

---

<div class="post-metadata">

**Author:** ![talves](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/talves/32/101_2.png) [@talves](https://answers.netlify.com/u/talves)\
**Post date:** [January 26, 2026, 5:42pm UTC](https://answers.netlify.com/t/complex-build-rust-js/159131/7 "2026-01-26T17:42:34Z")

</div>

> [@dougalg](#):
>
> After putting a `rust-toolchain.toml` in the root

Glad it worked. Awesome.

It’s not flakiness. It’s the fact that assets for your builds are cached and there is some side effect causing it to fail.
