rustwasm / wasm-pack

📦✨ your favorite rust -> wasm workflow tool!
https://rustwasm.github.io/wasm-pack/
Apache License 2.0
6.32k stars 409 forks source link

After updating rustup, cannot build a project anymore #1340

Open Horusiath opened 1 year ago

Horusiath commented 1 year ago

🐛 Bug description

After running rustup update, calling wasm-pack build --target nodejs over the project it worked so far, no longer works. The error is as follows:

[INFO]: 🎯 Checking for the Wasm target... Error: wasm32-unknown-unknown target not found in sysroot: "/usr/local/Cellar/rust/1.72.0_2"

Used rustc from the following path: "/usr/local/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.

Caused by: wasm32-unknown-unknown target not found in sysroot: "/usr/local/Cellar/rust/1.72.0_2"

Used rustc from the following path: "/usr/local/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.

🌍 Your environment

OS: MacOS wasm-pack version: 0.12.1 rustup show:

rustup show
Default host: x86_64-apple-darwin
rustup home:  /Users/bartoszsypytkowski/.rustup

installed toolchains
--------------------

stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin (default)
1.67.0-x86_64-apple-darwin
1.69.0-x86_64-apple-darwin
1.70.0-x86_64-apple-darwin
1.71.0-x86_64-apple-darwin

installed targets for active toolchain (stable)
--------------------------------------

wasm32-unknown-unknown
wasm32-wasi
x86_64-apple-darwin

active toolchain
----------------

stable-x86_64-apple-darwin (default)
rustc 1.73.0 (cc66ad468 2023-10-03)

installed targets for active toolchain (nightly)
--------------------------------------

wasm32-unknown-unknown
x86_64-apple-darwin
x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-x86_64-apple-darwin (default)
rustc 1.75.0-nightly (49691b1f7 2023-10-16)

Issue remains regardless of me using nightly or stable toolchain version. Other Rust projects (not using wasm-pack) can be compiled via cargo without issues.

cdmistman commented 1 year ago
Error: wasm32-unknown-unknown target not found in sysroot: "/usr/local/Cellar/rust/1.72.0_2"

Used rustc from the following path: "/usr/local/bin/rustc"

can you try uninstalling rust from homebrew? brew uninstall rust

Horusiath commented 1 year ago

Eventually I uninstalled everything (using brew uninstall rust and rustup self uninstall) and reinstalled rustup again to solve this issue.

gthb commented 1 month ago

For me brew uninstall rust was enough.