HellSquirrel / wasm-train-the-dragon-examples

35 stars 6 forks source link

`wasm-pack new rust-example` is failed #3

Open wafuwafu13 opened 3 years ago

wafuwafu13 commented 3 years ago

Thanks for making a nice tutorial :)

Explanation

Wasm-pack uses the same approach for generating projects as rails new or create-react-app:

docker run --rm -v $(pwd):$(pwd) -w $(pwd) -e "USER=$(whoami)" zloymult/wasm-build-kit wasm-pack new rust-example

Now you can cd into the rust-example folder and open it in your editor.

Actuality

$ docker run --rm -v $(pwd):$(pwd) -w $(pwd) -e "USER=$(whoami)" zloymult/wasm-build-kit wasm-pack new rust-example
[INFO]: Installing cargo-generate...
error: the `--vers` provided, `latest`, is not a valid semver version: cannot parse 'latest' as a semver

Error: Installing cargo-generate with cargo
Caused by: failed to execute `cargo install`: exited with exit code: 101
  full command: "cargo" "install" "--force" "cargo-generate" "--version" "latest" "--root" "/root/.cache/.wasm-pack/.cargo-generate-cargo-install-latest"

Development Environment

$ sw_vers
ProductName:    macOS
ProductVersion: 11.4
BuildVersion:   20F71

$ docker --version
Docker version 20.10.2, build 2291f61

Related (may be)

https://github.com/rustwasm/wasm-pack/issues/907

microwavestine commented 2 years ago

I struggled with this and just ended up downloading wasm-pack locally, then wasm-pack build --release --target web from rust-example folder. It should successfully generate pkg folder like in the tutorial.