Skip to content

Error on npm run devΒ #36

@lumi-a

Description

@lumi-a

Running npm run dev yields a wasm-import-error for me. I'm on 3dcf63a.

$ cd client

$ cat .nvmrc
18.20.x

$ node --version
v22.13.1

$ rustc --version
rustc 1.85.1 (4eb161250 2025-03-15)

$ npm run dev

> dev
> webpack-dev-server --mode development --open --port 9090

Failed to load ./.env.

[...]

WARNING in GenerateSW has been called multiple times, perhaps due to running webpack in --watch mode. The precache manifest generated after the first call may be inaccurate! Please see https://github.com/GoogleChrome/workbox/issues/1790 for more information.

ERROR in ../mandelbrot/pkg/index.js 5:0-21
Can't import the named export '__wbindgen_start' (imported as 'wasm') from default-exporting module (only default export is available)
 @ ./js/worker.js 15:0-30

Opening the (locally-served) website, the UI seems to render, but the mandelbrot-set does not. Things that did not help:

  • Changing to node version 18.20.8
  • Upgrading webpack npm i webpack@latest
  • Ensuring only locked dependencies are installed, via npm ci

npm run test (which just runs cargo test) is all-green. Trying npm run serve yields:

"GET /" "[...]"
(node:20060) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
"GET /app.js" "[...]"
"GET /main.css" "[...]"
"GET /app.js" Error (404): "Not found"
"GET /main.css" Error (404): "Not found"
"GET /" Error (404): "Not found"
"GET /service-worker.js" "[...]"
"GET /workbox-1b82644a.js" "[...]"
"GET /service-worker.js" Error (404): "Not found"
"GET /workbox-1b82644a.js" Error (404): "Not found"
Full log
$ cd client

$ cat .nvmrc
18.20.x

$ node --version
v22.13.1

$ rustc --version
rustc 1.85.1 (4eb161250 2025-03-15)

$ npm run dev

> dev
> webpack-dev-server --mode development --open --port 9090

Failed to load ./.env.
🧐  Checking for wasm-pack...

βœ…  wasm-pack is installed at [...]\.cargo\bin\wasm-pack.EXE.

ℹ️  Compiling your crate in development mode...

<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:9090/
<i> [webpack-dev-server] On Your Network (IPv4): [...]
<i> [webpack-dev-server] On Your Network (IPv6): [...]
<i> [webpack-dev-server] Content not from webpack is served from '[...]\Mandelbrot.site\client\public' directory
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: πŸŒ€  Compiling to Wasm...
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.25s
[INFO]: ⬇️  Installing wasm-bindgen...
[INFO]: Optional field missing from Cargo.toml: 'license'. This is not necessary, but recommended
[INFO]: ✨   Done in 0.84s
[INFO]: πŸ“¦   Your wasm pkg is ready to publish at [...]\Mandelbrot.site\mandelbrot\pkg.
βœ…  Your crate has been correctly compiled

<i> [webpack-dev-middleware] wait until bundle finished: /
<i> [webpack-dev-middleware] wait until bundle finished: /app.js
<i> [webpack-dev-middleware] wait until bundle finished: /main.css
<i> [webpack-dev-middleware] wait until bundle finished: /static/apple-touch-icon.png
<i> [webpack-dev-middleware] wait until bundle finished: /static/favicon.ico
<i> [webpack-dev-middleware] wait until bundle finished: /service-worker.js
assets by status 2.56 MiB [emitted]
  assets by chunk 1.18 MiB (auxiliary name: main)
    assets by path ./ 1.18 MiB 14 assets
    assets by path *.png 197 bytes 3 assets
  assets by path *.html 83 KiB
    asset privacy-policy.html 20 KiB [emitted]
    + 6 assets
  assets by path *.js 1.25 MiB
    asset app.js 1.24 MiB [emitted] (name: main) 1 related asset
    + 2 assets
  asset main.css 30 KiB [emitted] (name: main) 1 related asset
  asset service-worker.js.map 17.9 KiB [emitted]
assets by status 345 KiB [compared for emit]
  asset workbox-1b82644a.js.map 218 KiB [compared for emit]
  asset workbox-1b82644a.js 127 KiB [compared for emit]
Entrypoint main 1.27 MiB (2.59 MiB) = main.css 30 KiB app.js 1.24 MiB 19 auxiliary assets
runtime modules 74.7 KiB 42 modules
orphan modules 78.4 KiB (javascript) 197 bytes (asset) [orphan] 13 modules
modules by path ./node_modules/ 1010 KiB (javascript) 13.6 KiB (css/mini-extract) 155 modules
modules by path ./static/ 683 bytes
  modules by path ./static/*.png 500 bytes 7 modules
  + 3 modules
modules by path ./js/*.ts 66.4 KiB
  ./js/index.ts 1.17 KiB [built] [code generated]
  ./js/static.ts 542 bytes [built] [code generated]
  + 5 modules
modules by path ./css/ 1.41 KiB (javascript) 15.4 KiB (css/mini-extract)
  javascript modules 1.41 KiB 2 modules
  css modules 15.4 KiB 2 modules
./netlify.toml 58 bytes [built] [code generated]

LOG from GenerateSW
<i> The service worker at service-worker.js will precache
<i>         27 URLs, totaling 2.66 MB.

WARNING in GenerateSW has been called multiple times, perhaps due to running webpack in --watch mode. The precache manifest generated after the first call may be inaccurate! Please see https://github.com/GoogleChrome/workbox/issues/1790 for more information.

webpack 5.99.7 compiled with 1 warning in 8752 ms

assets by status 810 KiB [cached] 4 assets
assets by path . 354 KiB
  assets by path *.js 130 KiB
    asset workbox-1b82644a.js 127 KiB [emitted]
    asset service-worker.js 2.97 KiB [emitted]
  assets by path *.map 224 KiB
    asset workbox-1b82644a.js.map 218 KiB [emitted]
    asset service-worker.js.map 5.66 KiB [emitted]
cached modules 152 KiB (javascript) 160 KiB (asset) 27.4 KiB (runtime) [cached] 52 modules
modules by layer 7.58 KiB (javascript) 416 KiB (asset)
  ../mandelbrot/pkg/index.js 167 bytes [built]
  ../mandelbrot/pkg/index_bg.wasm 416 KiB (asset) 42 bytes (javascript) [built]
  ../mandelbrot/pkg/index_bg.js 7.38 KiB [built]

LOG from GenerateSW
<i> The service worker at service-worker.js will precache
<i>         4 URLs, totaling 830 kB.

WARNING in GenerateSW has been called multiple times, perhaps due to running webpack in --watch mode. The precache manifest generated after the first call may be inaccurate! Please see https://github.com/GoogleChrome/workbox/issues/1790 for more information.

ERROR in ../mandelbrot/pkg/index.js 5:0-21
Can't import the named export '__wbindgen_start' (imported as 'wasm') from default-exporting module (only default export is available)
 @ ./js/worker.js 15:0-30

webpack 5.99.7 compiled with 1 error and 1 warning in 1048 ms
<i> [webpack-dev-server] Gracefully shutting down. To force exit, press ^C again. Please wait...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions