Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Hello world example not working #4168

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

Closed
Kofituo opened this issue Oct 10, 2024 · 2 comments
Closed

Hello world example not working #4168

Kofituo opened this issue Oct 10, 2024 · 2 comments
Labels

Comments

@Kofituo
Copy link

Kofituo commented Oct 10, 2024

Describe the Bug

I'm trying to use this library as given in the examples sections but it doesn't work

Steps to Reproduce

Create a new repository and try out any of the examples in the example folder

Expected Behavior

It should compile without any errors

Actual Behavior

kofiotuo@Kofis-MacBook-Pro-2 untitled2 % npm run serve

> serve
> webpack serve

🧐  Checking for wasm-pack...

✅  wasm-pack is installed at /Users/kofiotuo/.cargo/bin/wasm-pack. 

ℹ️  Compiling your crate in development mode...

<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://192.168.100.4:8080/
<i> [webpack-dev-server] Content not from webpack is served from '/Users/kofiotuo/IdeaProjects/untitled2/public' directory
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
[INFO]: ⬇️  Installing wasm-bindgen...
[INFO]: Optional fields missing from Cargo.toml: 'description', 'repository', and 'license'. These are not necessary, but recommended
[INFO]: ✨   Done in 0.31s
[INFO]: 📦   Your wasm pkg is ready to publish at /Users/kofiotuo/IdeaProjects/untitled2/pkg.
✅  Your crate has been correctly compiled

assets by path *.js 285 KiB
  asset index.js 279 KiB [emitted] (name: main)
  asset pkg_index_js.index.js 6.36 KiB [emitted]
asset a1165bbc02befc246ad1.module.wasm 1.42 KiB [emitted] [immutable]
asset index.html 232 bytes [emitted]
runtime modules 31.5 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
    ./node_modules/html-entities/lib/index.js 4.84 KiB [built] [code generated]
    + 3 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.88 KiB (javascript) 6.73 KiB (webassembly)
  ./pkg/index.js 167 bytes [built] [code generated]
  ./pkg/index_bg.wasm 40 bytes (javascript) 6.73 KiB (webassembly) [built] [code generated] [1 error]
  ./pkg/index_bg.js 1.68 KiB [built] [code generated]
./index.js 82 bytes [built] [code generated]

ERROR in ./pkg/index_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/kofiotuo/IdeaProjects/untitled2/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1018:13)
    at parseTableSection (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1274:24)
    at parseSection (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1406:24)
    at Object.decode (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1740:25)
    at decode (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/@webassemblyjs/wasm-parser/lib/index.js:253:21)
    at WebAssemblyParser.parse (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/webpack/lib/wasm-async/AsyncWebAssemblyParser.js:61:19)
    at /Users/kofiotuo/IdeaProjects/untitled2/node_modules/webpack/lib/NormalModule.js:1303:19
    at processResult (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/webpack/lib/NormalModule.js:937:11)
    at /Users/kofiotuo/IdeaProjects/untitled2/node_modules/webpack/lib/NormalModule.js:1030:5
    at /Users/kofiotuo/IdeaProjects/untitled2/node_modules/loader-runner/lib/LoaderRunner.js:407:3
 @ ./pkg/index.js 1:0-40 4:15-19 5:0-21
 @ ./index.js 3:0-15

webpack 5.95.0 compiled with 1 error in 671 ms
assets by status 8.01 KiB [cached] 3 assets
assets by status 280 KiB [emitted]
  asset index.js 279 KiB [emitted] (name: main)
  asset main.7b6388042cca00f9272c.hot-update.js 843 bytes [emitted] [immutable] [hmr] (name: main)
  asset main.7b6388042cca00f9272c.hot-update.json 28 bytes [emitted] [immutable] [hmr]
Entrypoint main 280 KiB = index.js 279 KiB main.7b6388042cca00f9272c.hot-update.js 843 bytes
cached modules 185 KiB [cached] 28 modules
runtime modules 31.5 KiB 15 modules
modules by layer 1.88 KiB (javascript) 6.73 KiB (webassembly)
  ./pkg/index.js 167 bytes [built]
  ./pkg/index_bg.wasm 40 bytes (javascript) 6.73 KiB (webassembly) [built] [1 error]
  ./pkg/index_bg.js 1.68 KiB [built]

ERROR in ./pkg/index_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/kofiotuo/IdeaProjects/untitled2/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1018:13)
    at parseTableSection (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1274:24)
    at parseSection (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1406:24)
    at Object.decode (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1740:25)
    at decode (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/@webassemblyjs/wasm-parser/lib/index.js:253:21)
    at WebAssemblyParser.parse (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/webpack/lib/wasm-async/AsyncWebAssemblyParser.js:61:19)
    at /Users/kofiotuo/IdeaProjects/untitled2/node_modules/webpack/lib/NormalModule.js:1303:19
    at processResult (/Users/kofiotuo/IdeaProjects/untitled2/node_modules/webpack/lib/NormalModule.js:937:11)
    at /Users/kofiotuo/IdeaProjects/untitled2/node_modules/webpack/lib/NormalModule.js:1030:5
    at /Users/kofiotuo/IdeaProjects/untitled2/node_modules/loader-runner/lib/LoaderRunner.js:407:3
 @ ./pkg/index.js 1:0-40 4:15-19 5:0-21
 @ ./index.js 3:0-15

webpack 5.95.0 compiled with 1 error in 14 ms

Here's the repository link https://github.com/Kofituo/hello-world

@Kofituo Kofituo added the bug label Oct 10, 2024
@rustwasm rustwasm locked and limited conversation to collaborators Oct 10, 2024
@daxpedda daxpedda converted this issue into discussion #4171 Oct 10, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

2 participants
@Kofituo and others