wasm-pack
wasm-pack copied to clipboard
No package.json generated on Apple Silicon (works on Intel)
🐛 Bug description
- Following the basic tutorial for rust on wasm
Related issue filed against the tutorial https://github.com/rustwasm/book/issues/254
🤔 Expected Behavior
On M1, file hierarchy is:
~/Developer/Rust/wasm-game-of-life (master #) $ ls -l pkg
total 48
-rw-r--r-- 1 andrew staff 2170 Nov 13 15:09 README.md
-rw-r--r-- 1 andrew staff 80 Nov 15 11:39 wasm_game_of_life.d.ts
-rw-r--r-- 1 andrew staff 95 Nov 15 11:39 wasm_game_of_life.js
-rw-r--r-- 1 andrew staff 832 Nov 15 11:39 wasm_game_of_life_bg.js
-rw-r--r-- 1 andrew staff 430 Nov 15 11:39 wasm_game_of_life_bg.wasm
-rw-r--r-- 1 andrew staff 114 Nov 15 11:39 wasm_game_of_life_bg.wasm.d.ts
On Intel mac (12.1 Beta (21C5021h)
), file hierarchy is:
~/Developer/Rust/wasm-game-of-life (master #) $ ls -l pkg
total 56
-rw-r--r-- 1 andrew staff 2170 Nov 15 11:12 README.md
-rw-r--r-- 1 andrew staff 360 Nov 15 11:21 package.json
-rw-r--r-- 1 andrew staff 80 Nov 15 11:21 wasm_game_of_life.d.ts
-rw-r--r-- 1 andrew staff 95 Nov 15 11:21 wasm_game_of_life.js
-rw-r--r-- 1 andrew staff 832 Nov 15 11:21 wasm_game_of_life_bg.js
-rw-r--r-- 1 andrew staff 288 Nov 15 11:21 wasm_game_of_life_bg.wasm
-rw-r--r-- 1 andrew staff 114 Nov 15 11:21 wasm_game_of_life_bg.wasm.d.ts
👟 Steps to reproduce
Follow rust tutorial https://rustwasm.github.io/book/game-of-life/hello-world.html
~/Developer/Rust/wasm-game-of-life (master #) $ 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: `wasm-game-of-life` (lib) generated 1 warning
Finished release [optimized] target(s) in 0.02s
[INFO]: ⬇️ Installing wasm-bindgen...
Error: no prebuilt wasm-opt binaries are available for this platform: Unrecognized target!
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
🌍 Your environment
Intel: 12.1 Beta (21C5021h) M1: 12.1 Beta (21C5031d)
Same versions installed on both intel and m1 pro machine: wasm-pack version: 0.10.1 rustc version: 1.56.1 (59eed8a2a 2021-11-01)
I think this is the actual issue: https://github.com/rustwasm/wasm-pack/issues/913 ie the WASM was built but not optimized, and the process errored out before the package.json could be written.
@darknoon also the error message indicates that #913 is the real problem
[INFO]: ⬇️ Installing wasm-bindgen... Error: no prebuilt wasm-opt binaries are available for this platform: Unrecognized target!
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