wasm-pack: failed to download binaryen-version_90-x86-windows.tar.gz

🐛 Bug description

Describe your issue in detail. wasm-pack download error

🤔 Expected Behavior

What should have happened? I am beginner for Rust and Webassembly , I follow the Hello, World! to do

I am run

$ wasm-pack build

λ wasm-pack build
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
warning: function is never used: `set_panic_hook`
 --> src\utils.rs:1:8
  |
1 | pub fn set_panic_hook() {
  |        ^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

    Finished release [optimized] target(s) in 0.10s
Error: failed to download from https://github.com/WebAssembly/binaryen/releases/download/version_90/binaryen-version_90-x86-windows.tar.gz
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.

My Internet is so bad that I want manually install binaryen-version_90-x86-windows.tar.gz OS: Window10 Now I have binaryen-version_90-x86-windows.tar.gz

asm2wasm.exe binaryen.dll wasm-as.exe wasm-ctor-eval.exe wasm-dis.exe wasm-emscripten-finalize.exe wasm-metadce.exe wasm-opt.exe wasm-reduce.exe wasm-shell.exe wasm2js.exe

Where should I put in this file ? And I try to wasm-pack again It’s will stop in

λ wasm-pack.exe build
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
warning: function is never used: `set_panic_hook`
 --> src\utils.rs:1:8
  |
1 | pub fn set_panic_hook() {
  |        ^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

    Finished release [optimized] target(s) in 0.25s

👟 Steps to reproduce

Clear steps describing how to reproduce the issue, including commands and flags run. If you are seeing an error, please include the full error message and stack trace.

🌍 Your environment

Include the relevant details of your environment. wasm-pack version:wasm-pack 0.9.1 rustc version:rustc 1.44.0 (49cae5576 2020-06-01)

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 9
  • Comments: 26

Commits related to this issue

Most upvoted comments

This work for me(Macos):

wget -O /tmp/binaryen.tar.gz https://github.com/WebAssembly/binaryen/releases/download/version_111/binaryen-version_111-x86_64-macos.tar.gz
tar -xvf /tmp/binaryen.tar.gz -C /tmp
cp /tmp/binaryen-version_111/bin/wasm-opt ~/.cargo/bin/
cp -r /tmp/binaryen-version_111/lib ~/.cargo/
rm -rf /tmp/binaryen.tar.gz /tmp/binaryen-version_111/

I have the same error. For now I’ve disabled optimization by adding this in my Cargo.toml

[package.metadata.wasm-pack.profile.release]
wasm-opt = false

I hope someone give a proper answer.

@asurance I’m not sure what went wrong on your side, but manually installing into C:\Users\<user-name>\.cargo\bin worked for me.

This issue is a duplicate of #886 I believe

I don’t think so, because #886 was fixed/closed, but this problem persists

我也遇到了相同的问题,不过我已经解决了。 我的环境是windows,但是我想其他系统的解决方式应该差不多,因为我是在查看wasm-pack的源码时,发现的一个可行的处理办法。 如果你想知道具体源码是什么,建议自行前往并寻找,这并不复杂。 关键在于,wasm-pack在下载前,会使用 which::which("wasm-opt")查找相关的可执行文件位置。而which会在环境变量的PATH中进行寻找。 所以最后的解决办法很简单,在windows上,请把你下载的binaryen-version_90-x86-windows.tar.gz压缩包内的内容,放置到一个提前准备好wasm-opt的文件夹内,例如:D:\rust\binaryen\wasm-opt

最后将这个路径加入系统环境变量PATH中:D:\rust\binaryen\wasm-opt\bin

注意设置好环境变量后,需要重新打开一个新的命令控制台。

en I had the same problem, but I already solved it.

My environment is Windows, but I think the solution for other systems should be similar, because I found a feasible solution when I was viewing the source code of wasm-pack.

If you want to know the specific source code, it is recommended to go and find it yourself, which is not complicated.

The key is that before downloading, wasm-pack will use which::which("wasm-opt") to find the location of the relevant executable file. And which will look in the PATH environment variable.

So the final solution is very simple, on Windows, please place the contents of the downloaded binaryen-version_90-x86-windows.tar.gz compressed package into a folder prepared in advance named wasm-opt, for example: D:\rust\binaryen\wasm-opt.

Finally, add this path to the system environment variable PATH: D:\rust\binaryen\wasm-opt\bin.

Note that after setting the environment variable, you need to reopen a new command console.

The file seems to be truly missing from the location it is expecting to download it from . Running the following to install from source resolved the wasm-opt error:

cargo install wasm-bindgen-cli

the lastest version 0.2.83 worked successfully. change the dependence version from specifiy to 0.2, such as change 0.2.63 to 0.2

This recently has started failing for me using Github Actions. The workarounds mentioned in https://github.com/rustwasm/wasm-pack/issues/886 do not fix this, only disabling wasm-opt = false

Error: failed to download from https://github.com/WebAssembly/binaryen/releases/download/version_90/binaryen-version_90-x86-linux.tar.gz
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
Error: Process completed with exit code 1.

My current workaround is to manually download and run wasm-opt:

wget -O /tmp/binaryen-version_90-x86-linux.tar.gz  https://github.com/WebAssembly/binaryen/releases/download/version_90/binaryen-version_90-x86-linux.tar.gz
tar -xvf /tmp/binaryen-version_90-x86-linux.tar.gz -C /tmp
/tmp/binaryen-version_90/wasm-opt <file>.wasm -o <file>.wasm -Oz

I know where to download and I had downloaded.I just don’t know where to install.I tried C:\Users\***\.cargo\bin, but it took no effect.