wasm-pack icon indicating copy to clipboard operation
wasm-pack copied to clipboard

cargo install wasm-opt if not present

Open nilskch opened this issue 1 year ago • 0 comments

I ran into https://github.com/rustwasm/wasm-pack/issues/1280. This issue is closed but this still seems to be a problem.

I ran into the following error:

$ wasm-pack build --target web --out-name wasm --out-dir ./static
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
    Finished `release` profile [optimized] target(s) in 0.01s
[INFO]: ⬇️  Installing wasm-bindgen...
Error: failed to download from https://github.com/WebAssembly/binaryen/releases/download/version_117/binaryen-version_117-arm64-macos.tar.gz
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
Caused by: failed to download from https://github.com/WebAssembly/binaryen/releases/download/version_117/binaryen-version_117-arm64-macos.tar.gz
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.

The original code was written 5 years ago and I assume back then it was not possible to cargo install wasm-opt. Now it is and this PR fixes the referenced issue.

PS: If you manually run cargo install wasm-opt before running wasm-pack [...] you do not have this problem but this PR prevents this step.

Make sure these boxes are checked! 📦✅

  • [x] You have the latest version of rustfmt installed
$ rustup component add rustfmt
  • [x] You ran cargo fmt on the code base before submitting
  • [x] You reference which issue is being closed in the PR text

✨✨ 😄 Thanks so much for contributing to wasm-pack! 😄 ✨✨

nilskch avatar Aug 05 '24 23:08 nilskch