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

Closed
montonero opened this issue Feb 14, 2019 · 3 comments

Comments

@montonero
Copy link

commented Feb 14, 2019

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

Output:


➜  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
6624c5191ac1363cd403.module.wasm
/home/igor/prog/rust/wasm-game-of-life/pkg/wasm_game_of_life_bg.wasm
unexpected end
ℹ 「wdm」: Failed to compile.

Rust toolchain versions

➜  www git:(master) ✗ 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
--------------------------------------

wasm32-unknown-unknown
x86_64-unknown-linux-gnu

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)

Node/npm

➜  www git:(master) ✗ node -v
v11.9.0
➜  www git:(master) ✗ npm -v
6.8.0
@fitzgen

This comment has been minimized.

Copy link
Member

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 Feb 14, 2019

@fitzgen

This comment has been minimized.

Copy link
Member

commented Feb 14, 2019

Thanks for filing an issue!

@prichey

This comment has been minimized.

Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.