Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: the -Z flag is only accepted on the nightly channel of Cargo, but this is the stable channel #1456

Closed
kjxbyz opened this issue Dec 15, 2024 · 1 comment

Comments

@kjxbyz
Copy link

kjxbyz commented Dec 15, 2024

🐛 Bug description

ying@Kimmys-iMac my_app % wasm-pack build -t no-modules -d /Users/ying/my_app/web/pkg --no-typescript --out-name rust_lib_my_app rust -- -Z build-std=std,panic_abort
[INFO]: 🎯  Checking for the Wasm target...
info: downloading component 'rust-std' for 'wasm32-unknown-unknown'
info: installing component 'rust-std' for 'wasm32-unknown-unknown'
 18.9 MiB /  18.9 MiB (100 %)  15.0 MiB/s in  1s ETA:  0s
[INFO]: 🌀  Compiling to Wasm...
error: the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
Error: Compiling your crate to WebAssembly failed
Caused by: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
  full command: cd "rust" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown" "-Z" "build-std=std,panic_abort"

🤔 Expected Behavior

What should have happened?

👟 Steps to reproduce

  1. git clone https://github.com/kjxbyz/my_app && cd my_app
  2. wasm-pack build -t no-modules -d ./web/pkg --no-typescript --out-name rust_lib_my_app rust -- -Z build-std=std,panic_abort

🌍 Your environment

Include the relevant details of your environment.
wasm-pack version:0.13.1
rustc version:1.83.0

@kjxbyz
Copy link
Author

kjxbyz commented Feb 23, 2025

It works for me.

rustup toolchain install nightly
rustup +nightly component add rust-src
rustup +nightly target add wasm32-unknown-unknown
# either of these
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
cargo install wasm-pack

@kjxbyz kjxbyz closed this as completed Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant