Hello! I was following the tutorial for wasm-pack and got to this step: https://rust-lang-nursery.github.io/rust-wasm/wasm-pack/package-code.html
Compiling took a while and then printed this:
wasm-pack -v init --scope thallada
[1/7] Adding WASM target...
[2/7] Compiling to WASM...
[3/7] Creating a pkg directory...
[4/7] Writing a package.json...
| [5/7] Copying over your README...
| :-) [WARN]: origin crate has no README
[6/7] Installing WASM-bindgen...
[7/7] Running WASM-bindgen...
:-) Done in 1 minute
:-) Your WASM pkg is ready to publish at ./pkg
But, if I look at the ./pkg directory, there's only a package.json file:
$ ls pkg/
package.json
Do you know what might have gone wrong?
$ npm --version
v9.11.1
$ npm --version
5.6.0
$ rustup show
Default host: x86_64-unknown-linux-gnu
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
installed targets for active toolchain
--------------------------------------
asmjs-unknown-emscripten
wasm32-unknown-emscripten
wasm32-unknown-unknown
x86_64-unknown-linux-gnu
active toolchain
----------------
nightly-x86_64-unknown-linux-gnu (default)
rustc 1.27.0-nightly (ac3c2288f 2018-04-18)
Same here, both Linux and Windows.
I installed wasm-bindgen globally and then it worked. It seems that this step is missing in the tutorial: cargo install wasm-bindgen-cli.
Looking into the code it seems that wasm-pack should install wasm-bindgen and, indeed, it does but for some reason there's a mismatch in the versions (I guess next version will fix this).
It seems that this is a known issue:

So just follow the previous instructions 馃槈
@ashleygwilliams, I'm thinking that maybe it would be nice to leverage the verbose flag so we could get the stdout from the wasm-bindgen process. I guess we could add this option here and we could also make this option explicit to the user at the end of any process so she can have a tool to directly use in case things didn't work as expected (as for instance happened to @thallada and myself).
EDIT: I can see that this is already planned in issue #50
@robertohuertasm thanks for the tip. cargo install -f wasm-bindgen-cli fixed it for me.
I did use wasm-pack's -v verbose flag, but that didn't print the error. So I think getting that to show the errors from wasm-bindgen would be really helpful.
hey all! sorry you ran into this trouble. so we have an 0.2.0 coming out, likely today that should fix this issue. we were definitely irresponsibly eating up stderr but that should be fixed! if you'd like to test it out before we release, you can run cargo install --git https://github.com/ashleygwilliams/wasm-pack.git to install this tool from master. we additionally plan on having some much nicer logs but what is currently on master should ideally solve this for you! do let me know and thanks for filing!
@ashleygwilliams , I did try a clean install directly from the github repo and it works as expected.
Unfortunately, I think I've found another issue with the resulting js file being renamed to index.js. Whenever I try to test it I get this error:

If I change the name of index.js to wasm-test and change the main entry in package.json accordingly then it all works flawlessly.
I've not had time to look carefully into it but it seems that the associated .wasm file refers to the jsfile by its old name. Does it make any sense?
I'll take a look again later to see what I can find.
oh iiiiiiinteresting. thank you so much for trying this out @robertohuertasm and for providing such a good detailed report. i don't think that the wasm should be referring to the js at all but i'm gonna dive into that now and see what's up!
@robertohuertasm ok, i misspoke, the wasm aboslutely refers to the js and i cannot and should not rename it. i'll need to revert that! thanks for noting it!
@ashleygwilliams you're very welcome! I'm really glad to help. :wink:
@robertohuertasm #105 should have fixed the issue for ya! :) hoping to cut a 0.2.0 release today! thanks again for all your help! let me know if you are interested in contributing at any point! we'd love to have you
@ashleygwilliams, it's awesome hearing about the 0.2.0 release! :grinning:
I've taken a look at #105. I feel a little bit curious about this "circular" reference between the js and the wasm file. I had the intention to study a little bit the wasm-bindgen repo to gain some insight on this matter but maybe you can point me out to the proper resource. :wink:
On the other hand, regarding my interest in contributing, I'd be really happy to provide my help or assistance. I really :hearts: what you guys are doing and I'm really interested in learning more about rust and wasm.