Skip to content

Doesn't automatically add wasm32-unknown-uknown target in Docker. #613

Closed
@mqsoh

Description

@mqsoh

🐛 Bug description

The official Docker image has rustup installed but wasm-pack doesn't automatically add the wasm32-unknown-unknown target when building for the first time.

🤔 Expected Behavior

It should have added the wasm32-unknown-unknown target automatically.

👟 Steps to reproduce

I came across this when going through the rust-wasm book. Here's the steps to reproduce but it involves a different repository from this one, so I hope the steps are acceptable.

$ docker run -it --rm --env USER rust:1.33.0-stretch bash -c '
cargo install cargo-generate;
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh;
cargo generate --git https://github.com/rustwasm/wasm-pack-template --name wasm-game-of-life;
cd wasm-game-of-life;
wasm-pack build;
'
...redacted a bunch of compiling...
   Compiling cargo-generate v0.2.2
    Finished release [optimized] target(s) in 3m 00s
  Installing /usr/local/cargo/bin/cargo-generate
info: downloading wasm-pack
info: successfully installed wasm-pack to `/usr/local/cargo/bin/wasm-pack`
 Creating project called `wasm-game-of-life`...
 Done! New project created /wasm-game-of-life
[INFO]: Checking for the Wasm target...
Error: wasm32-unknown-unknown target not found!
$

🌍 Your environment

wasm-pack version: latest?
rustc version: 1.33.0

I develop things out of Docker. I narrowed down the bug to this line in the wasm-pack source where it checks for a syspath/.rustup file. The Docker image has rustup but doesn't have this file.

$ docker run -it --rm rust:1.33.0-stretch bash -c 'echo Has rustup: $(which rustup); ls $(rustc --print sysroot)/.rustup;'
Has rustup: /usr/local/cargo/bin/rustup
ls: cannot access '/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/.rustup': No such file or directory

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions