I'm having trouble running the web repl. Here's the output I'm getting from repl_www/build.sh
+ [[ ! -d repl_www ]]
+ which wasm-pack
/home/degustaf/.cargo/bin/wasm-pack
+ WWW_ROOT=repl_www/build
+ mkdir -p repl_www/build
+ cp -r repl_www/public/repl repl_www/public/repl.css repl_www/public/repl.js repl_www/public/wasi.js repl_www/build
+ '[' -n '' ']'
+ wasm-pack build --target web repl_wasm
[INFO]: Checking for the Wasm target...
Error: wasm32-unknown-unknown target not found in sysroot: "/nix/store/hjjh1mnip37gahmn1w8w2z76lhmvi3aw-rustc-1.58.1"
Used rustc from the following path: "/nix/store/hjjh1mnip37gahmn1w8w2z76lhmvi3aw-rustc-1.58.1/bin/rustc"
It looks like Rustup is not being used. For non-Rustup setups, the wasm32-unknown-unknown target needs to be installed manually. See https://rustwasm.github.io/wasm-pack/book/prerequisites/non-rustup-setups.html on how to do this.
How are other people doing this? Are you using rustup?
I probably work on this the most. I do have rustup installed yes.
Then should we be adding it to shell.nix?
And I assume that's how I got the wasm32 target! I would remember if I did some special manual thing.
I have no idea, I'm not using nix
Ah, nix doesn't use rust up and instead directly install rustc and cargo and such
Maybe we should switch nix to use rustup. I know it is supported by nix.
I added rustup to nix locally, and got a different error.
+ [[ ! -d repl_www ]]
+ which wasm-pack
/home/degustaf/.cargo/bin/wasm-pack
+ WWW_ROOT=repl_www/build
+ mkdir -p repl_www/build
+ cp -r repl_www/public/repl repl_www/public/repl.css repl_www/public/repl.js repl_www/public/wasi.js repl_www/build
+ '[' -n '' ']'
+ wasm-pack build --target web repl_wasm
Error: Error during execution of `cargo metadata`: error: no override and no default toolchain set
Could this be because the rest of the toolchain is installed directly?
probably
your "other" cargo might not know about the toolchain that rustup specified
Yeah, nix cargo doesn't know of rustup. It is separate
okay, I'm cleaning out my nix store, and trying again using rustup in shell.nix instead of the individual rust tools
Cleaning out my nix store probably wasn't the right answer, but it eventually worked.
I think the right answer would be having nix install rustup. Then add a step under nix in BUILDING_FROM_SOURCE telling people to install the toolchains using rustup and setting them as the default.
We should probably add a rust-toolchain.toml
file to the project instead of having people set the default manually. That can also be used by everyone else to keep rust version consistent
I wasn't aware that was an option. Sounds like a good idea to me
I have set up a PR with the rust-toolchain file. I'll look into using rustup when I do the nix flake setup.
Sorry, probably should have said something here. I already did this.
https://github.com/rtfeldman/roc/pull/2667
No problem :+1:
Last updated: Jul 06 2025 at 12:14 UTC