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

wasm-pack.exe build hang forever

Open patricksuo opened this issue 4 years ago • 7 comments

🐛 Bug description

\wasm-game-of-life> wasm-pack.exe build --release
[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.05s

the build command never finish

🌍 Your environment

Include the relevant details of your environment. wasm-pack version: 0.9.1

rustc version: rustc 1.46.0 (04488afe3 2020-08-24)

I also tried wasm-pack.exe build -dev, it works as expected.

patricksuo avatar Oct 04 '20 07:10 patricksuo

Also happened to me.

shrinktofit avatar Nov 13 '20 14:11 shrinktofit

Same here, this time in WSL2 Ubuntu 20.04. Running with --dev works, without it, just running wasm-pack --verbose build --target nodejs logs:

[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
    Finished release [optimized] target(s) in 0.02s

then hangs indefinitely without exiting and doesn't generate a package.json file.

codepunkt avatar Dec 20 '20 16:12 codepunkt

i think this might be due to wasm-opt, gonna tag as a wasm-opt bug, i'm working on a PR that makes wasm-opt opt-in by default. can you try to add this to your Cargo.toml and see if it fixes your issues?

# `wasm-opt` is on by default in for the release profile, but it can be
# disabled by setting it to `false`
[package.metadata.wasm-pack.profile.release]
wasm-opt = false

ashleygwilliams avatar Dec 21 '20 17:12 ashleygwilliams

@ashleygwilliams yes, it fixes my issue.

patricksuo avatar Dec 25 '20 14:12 patricksuo

comment was a leftover from my other issue. disabling wasm-opt also helps here.

thanks @ashleygwilliams

codepunkt avatar Dec 26 '20 22:12 codepunkt

Same problem. Hasn't it been fixed?

d0u9 avatar Dec 22 '21 15:12 d0u9

still having problems, even with wasm-opt disabled

rhoit avatar Mar 24 '22 17:03 rhoit

I am also observing this behavior. The weird thing here, is that this only occurs when using a build script and only when trying to build a release build. Using wasm-pack directly in the terminal works without any problems. @ashleygwilliams Any ideas how I might debug this?

HusseinKabbout avatar Oct 30 '22 00:10 HusseinKabbout

I'm not sure if this is connected, but I had this issue and then increased the disk size of my vm and that fixed the problem. Might be related to running out of disk space?

tiby312 avatar Dec 22 '22 11:12 tiby312

Please try out v0.12.0 from one of the following ways:

  • https://github.com/rustwasm/wasm-pack/releases/tag/v0.12.0
  • https://crates.io/crates/wasm-pack/0.12.0
  • https://www.npmjs.com/package/wasm-pack/v/0.12.0

drager avatar Jun 17 '23 13:06 drager

wasm-pack cannot find wasm-opt in $PATH, so it attempts to download one.

By executing RUST_LOG=debug wasm-pack build and strace wasm-pack build, I discovered that wasm-pack is attempting to download https://github.com/WebAssembly/binaryen/releases/download/version_111/binaryen-version_111-x86_64-linux.tar.gz.

Luckily, there is apt install binaryen, which provides wasm-opt command. After installing it, wasm-pack is "satisfied" and won't download anything.

winston-wen avatar Jul 10 '23 07:07 winston-wen