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 - Module parse failed: Unknown element type in table: 0xNaN #74

Closed
Jeroendevr opened this issue Nov 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Jeroendevr
Copy link

Describe the Bug

Following the Game of Life tutorial at RustWasm I encounter the following executing

> [email protected] start
> webpack-dev-server

<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:8080/, http://[::1]:8080/
<i> [webpack-dev-server] On Your Network (IPv4): http://10.19.0.143:8080/
<i> [webpack-dev-server] Content not from webpack is served from '/Users/hayer/rust/wasm-game-of-life/www/public' directory
assets by path *.js 286 KiB
  asset bootstrap.js 280 KiB [emitted] (name: main)
  asset index_js.bootstrap.js 6.77 KiB [emitted]
asset b92850567747f7443a45.module.wasm 1.43 KiB [emitted] [immutable]
asset index.html 297 bytes [emitted] [from: index.html] [copied]
runtime modules 31.6 KiB 15 modules
modules by path ./node_modules/ 185 KiB
  modules by path ./node_modules/webpack-dev-server/client/ 81.9 KiB 17 modules
  modules by path ./node_modules/webpack/hot/*.js 5.17 KiB 4 modules
  modules by path ./node_modules/html-entities/lib/*.js 78.9 KiB 4 modules
  ./node_modules/ansi-html-community/index.js 4.16 KiB [built] [code generated]
  ./node_modules/events/events.js 14.5 KiB [built] [code generated]
modules by path ../pkg/ 1.39 KiB (javascript) 1.28 KiB (webassembly)
  ../pkg/wasm_game_of_life.js 203 bytes [built] [code generated]
  ../pkg/wasm_game_of_life_bg.wasm 40 bytes (javascript) 1.28 KiB (webassembly) [built] [code generated] [1 error]
  ../pkg/wasm_game_of_life_bg.js 1.15 KiB [built] [code generated]
modules by path ./*.js 337 bytes
  ./bootstrap.js 279 bytes [built] [code generated]
  ./index.js 58 bytes [built] [code generated]

ERROR in ../pkg/wasm_game_of_life_bg.wasm
Module parse failed: Unknown element type in table: 0xNaN
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Error: Unknown element type in table: 0xNaN
    at parseTableType (/Users/hayer/rust/wasm-game-of-life/www/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1018:13)
    at parseTableSection (/Users/hayer/rust/wasm-game-of-life/www/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1274:24)
    at parseSection (/Users/hayer/rust/wasm-game-of-life/www/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1406:24)
    at Object.decode (/Users/hayer/rust/wasm-game-of-life/www/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1740:25)
    at decode (/Users/hayer/rust/wasm-game-of-life/www/node_modules/@webassemblyjs/wasm-parser/lib/index.js:253:21)
    at WebAssemblyParser.parse (/Users/hayer/rust/wasm-game-of-life/www/node_modules/webpack/lib/wasm-async/AsyncWebAssemblyParser.js:61:19)
    at /Users/hayer/rust/wasm-game-of-life/www/node_modules/webpack/lib/NormalModule.js:1309:19
    at processResult (/Users/hayer/rust/wasm-game-of-life/www/node_modules/webpack/lib/NormalModule.js:938:11)
    at /Users/hayer/rust/wasm-game-of-life/www/node_modules/webpack/lib/NormalModule.js:1036:5
    at /Users/hayer/rust/wasm-game-of-life/www/node_modules/loader-runner/lib/LoaderRunner.js:407:3
 @ ../pkg/wasm_game_of_life.js 1:0-52 4:15-19 5:0-21
 @ ./index.js 1:0-42 3:0-10
 @ ./bootstrap.js 4:0-20

webpack 5.96.1 compiled with 1 error in 189 ms

Steps to Reproduce

# Step 1
cargo generate --git https://github.com/rustwasm/wasm-pack-template
# Step 2
# give name and cd into project
# Step 3
wasm-pack build
# Step 4
npm init wasm-app www
# Step 5 
cd www
# Step 6
npm install
# Step 7 
# Follow the change of dependencies at https://rustwasm.github.io/docs/book/game-of-life/hello-world.html#using-our-local-wasm-game-of-life-package-in-www
npm run start

Expected Behavior

A successfull build with a webpage with an alert message

Actual Behavior

See debug log above

Additional Context

The dependencies on the cargo.toml file are quite old. So I also tried with the newest dependencies.

@Jeroendevr Jeroendevr added the bug Something isn't working label Nov 5, 2024
@Jeroendevr
Copy link
Author

This issue was related to rustwasm/wasm-bindgen#4211

so using rust <= 1.81 or wasm-pack <= 0.2.93 is a workaround at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant