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

failed to download binaryen-version_90-x86-windows.tar.gz

Open WingDust opened this issue 4 years ago • 26 comments

🐛 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)

WingDust avatar Jun 18 '20 10:06 WingDust

I have the same problem.I download binaryen-version_90-x86-windows.tar.gz via web browser while I don't know where to install it.Can you share it with me? As for the problem you mentioned, it should not be a serious one.It just mean function set_panic_hook is not used. It just a tip for program optimization.

asurance avatar Jun 18 '20 15:06 asurance

By the way , wasm-pack don't generate package.json file so When I npm install

npm ERR! Could not install from "..\pkg" as it does not contain a package.json file.

And wasm-pack retry ,It's stop What I say above.

WingDust avatar Jun 18 '20 16:06 WingDust

So, can you tell me where binaryen-version_90-x86-windows.tar.gz should be installed?

asurance avatar Jun 18 '20 16:06 asurance

@asurance open Assets find version_90 Assets and click

WingDust avatar Jun 18 '20 16:06 WingDust

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.

asurance avatar Jun 18 '20 16:06 asurance

as same

WingDust avatar Jun 18 '20 16:06 WingDust

I find it can be skipped by cargo install wasm-bindgen-cli.Maybe you can try too.

asurance avatar Jun 19 '20 14:06 asurance

@asurance

λ cargo install wasm-bindgen-cli
    Updating `https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git` index
error: binary `wasm-bindgen-test-runner.exe` already exists in destination
binary `wasm-bindgen.exe` already exists in destination
binary `wasm2es6js.exe` already exists in destination
Add --force to overwrite

don't work

WingDust avatar Jun 19 '20 15:06 WingDust

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.

tafia avatar Jun 23 '20 01:06 tafia

This issue is a duplicate of https://github.com/rustwasm/wasm-pack/issues/886 I believe

SebastienGllmt avatar Sep 28 '20 06:09 SebastienGllmt

This issue is a duplicate of #886 I believe

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

ZosoDerGoldene avatar Jul 14 '21 18:07 ZosoDerGoldene

I met the same problem in Ubuntu 20.04 LTS. Hope to find the way to solve it. Here is my configuration:

  • rustwasmc 0.1.29
  • cargo 1.50.0 (f04e7fab7 2021-02-04)

xlcbingo1999 avatar Oct 26 '21 13:10 xlcbingo1999

I met the same problem in Ubuntu 20.04 LTS. Hope to find the way to solve it. Here is my configuration:

  • rustwasmc 0.1.29
  • cargo 1.50.0 (f04e7fab7 2021-02-04)

add more infomation:

[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
    Finished release [optimized] target(s) in 0.03s
:-) [WARN]: origin crate has no README
[INFO]: Installing wasm-bindgen...
[INFO]: Installing wasm-opt...
Error: failed to download from https://github.com/WebAssembly/binaryen/releases/download/version_90/binaryen-version_90-x86_64-linux.tar.gz
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.

My cargo.toml is:

[package]
name = "rust_mobilenet_food"
version = "0.1.0"
authors = ["ubuntu"]
edition = "2018"

[lib]
name = "rust_mobilenet_food_lib"
path = "src/lib.rs"
crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "=0.2.61"
wasmedge_tensorflow_interface = "^0.2.0"
image = { version = "0.23.0", default-features = false, features = ["jpeg", "png", "gif"] }
imageproc = "0.21.0"
serde = { version = "^1.0.59", features = ["derive"] }
serde_json = "^1.0.51"
urlencoding = "1.3.3"

my env:

  • rustc 1.50.0 (cb75ad5db 2021-02-10)
  • cargo 1.50.0 (f04e7fab7 2021-02-04)
  • rustwasmc 0.1.29

xlcbingo1999 avatar Oct 26 '21 14:10 xlcbingo1999

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

tkmcmaster avatar Nov 02 '21 15:11 tkmcmaster

replace dependency with the latest version wasm-bindgen = "0.2.78" works for me, i don`t know why

ghost avatar Nov 06 '21 02:11 ghost

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

hillin avatar Jul 19 '22 03:07 hillin

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

1714080902120 avatar Jan 26 '23 04:01 1714080902120

@tafia do you happen to know how to set the metadata for Cargo workspaces in order to work around this?

Qix- avatar Feb 12 '23 22:02 Qix-

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

stash763 avatar Feb 27 '23 06:02 stash763

Maybe you use npm/yarn install wasm-pack.

Just remove it and use cargo install instead.

yarn global remove wasm-pack
cargo install wasm-pack

voidmozx avatar Jul 29 '23 04:07 voidmozx

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/

magicwenli avatar Sep 07 '23 05:09 magicwenli

wired,i can download the file by using browser, but clion just failed.

hidoudou avatar Sep 22 '23 10:09 hidoudou

我也遇到了相同的问题,不过我已经解决了。 我的环境是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.

ypwxxx avatar Jan 05 '24 11:01 ypwxxx

我也遇到了相同的问题,不过我已经解决了。 我的环境是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.

这个方法好使,我曾经想试试这种方法,但觉得不太可能是这样吧,就没有去试。。。。。

"This method works well. I once thought about trying this approach, but I didn't think it would work like this, so I didn't try it..."

61go avatar Jan 09 '24 06:01 61go

我也遇到了相同的问题,不过我已经解决了。 我的环境是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.

这个方法好使,我曾经想试试这种方法,但觉得不太可能是这样吧,就没有去试。。。。。

"This method works well. I once thought about trying this approach, but I didn't think it would work like this, so I didn't try it..."

我先用一个空项目跑了一下witch相同逻辑的空项目,确实能拿到,就直接用了,然后一次成功。但是这个总是下载失败的问题是真的绷不住(host,VPN等等都试了),只能先这样解决了。

ypwxxx avatar Jan 09 '24 06:01 ypwxxx

Maybe you use npm/yarn install wasm-pack.

Just remove it and use cargo install instead.

yarn global remove wasm-pack
cargo install wasm-pack

It does not work

golanguage avatar Apr 05 '24 10:04 golanguage