Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run start fails (following the book) #148

pulcheri opened this issue Feb 14, 2019 · 5 comments

npm run start fails (following the book) #148

pulcheri opened this issue Feb 14, 2019 · 5 comments


Copy link

Whilst following the instructions in the book everything works fine until I try to serve with
npm run start


➜  www git:(master) ✗ npm run start             

> create-wasm-app@0.1.0 start /home/igor/prog/rust/wasm-game-of-life/www
> webpack-dev-server

ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
Failed to decode custom "name" section @1670; ignoring (integer representation too long).
✖ 「wdm」: Hash: 85fae98e126a162f5c24
Version: webpack 4.29.3
Time: 330ms
Built at: 02/14/2019 12:37:32 PM
         Asset       Size  Chunks             Chunk Names
0.bootstrap.js   3.15 KiB       0  [emitted]  
  bootstrap.js    354 KiB    main  [emitted]  main
    index.html  175 bytes          [emitted]  
Entrypoint main = bootstrap.js
[0] multi (webpack)-dev-server/client?http://localhost:8080 ./bootstrap.js 40 bytes {main} [built]
[../pkg/wasm_game_of_life.js] 708 bytes {0} [built]
[./bootstrap.js] 279 bytes {main} [built]
[./index.js] 59 bytes {0} [built]
[./node_modules/ansi-html/index.js] 4.16 KiB {main} [built]
[./node_modules/events/events.js] 13.3 KiB {main} [built]
[./node_modules/html-entities/index.js] 231 bytes {main} [built]
[./node_modules/loglevel/lib/loglevel.js] 7.68 KiB {main} [built]
[./node_modules/url/url.js] 22.8 KiB {main} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost:8080] (webpack)-dev-server/client?http://localhost:8080 7.78 KiB {main} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.58 KiB {main} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.05 KiB {main} [built]
[./node_modules/webpack-dev-server/node_modules/strip-ansi/index.js] (webpack)-dev-server/node_modules/strip-ansi/index.js 161 bytes {main} [built]
[./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {main} [built]
[./node_modules/webpack/hot/emitter.js] (webpack)/hot/emitter.js 75 bytes {main} [built]
    + 14 hidden modules

ERROR in ../pkg/wasm_game_of_life_bg.wasm
Module parse failed: Unexpected section: 0xfa
You may need an appropriate loader to handle this file type.
Error: Unexpected section: 0xfa
    at new CompileError (/home/igor/prog/rust/wasm-game-of-life/www/node_modules/@webassemblyjs/helper-api-error/lib/index.js:40:109)
    at parseSection (/home/igor/prog/rust/wasm-game-of-life/www/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1542:11)
    at Object.decode (/home/igor/prog/rust/wasm-game-of-life/www/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1559:25)
    at decode (/home/igor/prog/rust/wasm-game-of-life/www/node_modules/@webassemblyjs/wasm-parser/lib/index.js:240:21)
    at WebAssemblyParser.parse (/home/igor/prog/rust/wasm-game-of-life/www/node_modules/webpack/lib/wasm/WebAssemblyParser.js:74:19)
    at doBuild.err (/home/igor/prog/rust/wasm-game-of-life/www/node_modules/webpack/lib/NormalModule.js:460:32)
    at runLoaders (/home/igor/prog/rust/wasm-game-of-life/www/node_modules/webpack/lib/NormalModule.js:342:12)
    at /home/igor/prog/rust/wasm-game-of-life/www/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/igor/prog/rust/wasm-game-of-life/www/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/home/igor/prog/rust/wasm-game-of-life/www/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/home/igor/prog/rust/wasm-game-of-life/www/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
    at provider (/home/igor/prog/rust/wasm-game-of-life/www/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9)
    at /home/igor/prog/rust/wasm-game-of-life/www/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:54:3)
 @ ../pkg/wasm_game_of_life.js 2:0-47 8:71-82 9:45-56 26:11-21
 @ ./index.js
 @ ./bootstrap.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./bootstrap.js

ERROR in chunk 0
unexpected end
ℹ 「wdm」: Failed to compile.

Rust toolchain versions

➜  www git:(master) ✗ rustup show
Default host: x86_64-unknown-linux-gnu

installed toolchains

nightly-x86_64-unknown-linux-gnu (default)

installed targets for active toolchain


active toolchain

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.34.0-nightly (e54494727 2019-02-13)

➜  www git:(master) ✗ rustc -V
rustc 1.34.0-nightly (e54494727 2019-02-13)
➜  www git:(master) ✗ cargo -V
cargo 1.34.0-nightly (865cb7010 2019-02-10)


➜  www git:(master) ✗ node -v
➜  www git:(master) ✗ npm -v
Copy link

fitzgen commented Feb 14, 2019

This is a latent bug in a library that webpack uses, which was recently triggered by updates in wasm-bindgen. Follow webpack/webpack#8786 for the fix to enter webpack.

In the meantime, you can try hardcoding wasm-bindgen = "=0.2.34" in your Cargo.toml.

@fitzgen fitzgen closed this as completed Feb 14, 2019
Copy link

fitzgen commented Feb 14, 2019

Thanks for filing an issue!

Copy link

prichey commented Feb 17, 2019

FWIW I ran into the same issue and hard-coding the wasm-bindgen version worked. Might be worth mentioning in the copy while this is still an issue?

Thanks for the book btw!

Copy link

I've still be getting this issue using 0.2.50. When attempting to pin to the above suggested version, errors with other dependencies like the wasm-bindgen-backend appear.

Copy link

rcoh commented Mar 2, 2020

FYI, this works with 0.2.58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

5 participants