mrk-its / bevy_webgl2

WebGL2 renderer plugin for Bevy game engine
MIT License
172 stars 46 forks source link

README example failed #27

Closed brianbruggeman closed 3 years ago

brianbruggeman commented 3 years ago

I think the documentation should also include:

$ cargo install wasm-bindgen-cli
$ cargo install basic-http-server

Additionally, I think that the script should explicitly set CARGO_TARGET_DIR if it's not set:

$ CARGO_TARGET_DIR=`pwd`/target cargo make example sprite --profile release

Finally, I think a screenshot of a working version would be handy so I know what to expect. Given no explicit debug information, it seems like this is just dead on arrival for me.

Reproducible Steps:

  1. Uninstall wasm-bindgen

  2. Uninstall basic-http-server

  3. Unset CARGO_TARGET_DIR

  4. Then follow along below

Followed along with:

cargo install cargo-make
rustup target add wasm32-unknown-unknown
cargo make example sprite --profile release

And it failed with:

[cargo-make] INFO - Execute Command: "wasm-bindgen" "--remove-name-section" "--remove-producers-section" "--out-dir" "target" "--out-name" "wasm" "--target" "web" "--no-typescript" "${CARGO_TARGET_DIR}/wasm32-unknown-unknown/release/examples/sprite.wasm"
[cargo-make] ERROR - Error while executing command, error: Os {
    code: 2,
    kind: NotFound,
    message: "No such file or directory",
}
[cargo-make] WARN - Build Failed.

So just to make sure, I ran:

wasm-bindgen --remove-name-section --remove-producers-section --out-dir target --out-name wasm --target web --no-typescript target/wasm32-unknown-unknown/release/examples/sprite.wasm 
zsh: command not found: wasm-bindgen

Assumption here is that there's a step missing to install wasm-bindgen.

Googling, it sounds like I could just install wasm-bindgen-cli:

cargo install wasm-bindgen-cli

Once it's installed, the wasm-bindgen command above passed. However, I needed to explicitly add CARGO_TARGET_DIR to my environment:

CARGO_TARGET_DIR=`pwd`/target cargo make example sprite --profile release

The next blocker was lacking basic-http-server. This was resolved with cargo install basic-http-server.

After installing and setting up, I was greeted with an empty page. I'm not sure what I should be expecting.

mrk-its commented 3 years ago

Thanks for very detailed description and reproducible steps, it was very helpful. I've just pushed fixes, let me know if it works for you.

brianbruggeman commented 3 years ago

This definitely improves the ergonomics of the installation process. Thank you!