denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.5k stars 5.37k forks source link

Error "Could not load '@vue/runtime-dom' " with deno 2.0.0-rc.4, but Deno v1.46.3 does not give that error. #25790

Closed rroblf01 closed 1 month ago

rroblf01 commented 1 month ago

Version: (Failed) Deno v2.0.0-rc.4 (Correctly) Deno v1.46.3

This error occurs when I run a Nuxt application with SSR, I currently have a linux distribution (Arch Linux), and these are the steps to reproduce the error:

Create a empty Nuxt project

[sheik@archlinux Documentos]$ npx nuxi@latest init deno_nuxt

✔ Which package manager would you like to use?
bun
◐ Installing dependencies...                                                                                                                                                                                                      16:35:31
bun install v1.1.26 (0a37423b)

$ nuxt prepare
✔ Types generated in .nuxt                                                                                                                                                                                                       16:35:34

+ nuxt@3.13.2
+ vue@3.5.7
+ vue-router@4.4.5

613 packages installed [3.18s]
✔ Installation completed.                                                                                                                                                                                                        16:35:34

✔ Initialize git repository?
Yes
ℹ Initializing git repository...                                                                                                                                                                                                 16:35:35

hint: Usando 'master' como el nombre de la rama inicial. Este nombre de rama predeterminado
hint: está sujeto a cambios. Para configurar el nombre de la rama inicial para usar en todos
hint: de sus nuevos repositorios, reprimiendo esta advertencia, llama a:
hint:
hint:   git config --global init.defaultBranch <nombre>
hint:
hint: Los nombres comúnmente elegidos en lugar de 'master' son 'main', 'trunk' y
hint: 'development'. Se puede cambiar el nombre de la rama recién creada mediante este comando:
hint:
hint:   git branch -m <nombre>
Inicializado repositorio Git vacío en /home/sheik/Documentos/deno_nuxt/.git/
                                                                                                                                                                                                                                  16:35:35
✨ Nuxt project has been created with the v3 template. Next steps:
 › cd deno_nuxt                                                                                                                                                                                                                   16:35:35
 › Start development server with bun run dev                                                                                                                                                                                      16:35:35
[sheik@archlinux Documentos]$ cd deno_nuxt/

Run build

[sheik@archlinux deno_nuxt]$ bun run build
$ nuxt build
Nuxt 3.13.2 with Nitro 2.9.7                                                                                                                                                                                                      16:35:47
ℹ Building client...                                                                                                                                                                                                             16:35:48
ℹ vite v5.4.7 building for production...                                                                                                                                                                                         16:35:48
ℹ ✓ 131 modules transformed.                                                                                                                                                                                                     16:35:49
ℹ .nuxt/dist/client/manifest.json                   1.06 kB │ gzip:  0.29 kB                                                                                                                                                     16:35:50
ℹ .nuxt/dist/client/_nuxt/error-500.B11Ibp8J.css    1.88 kB │ gzip:  0.72 kB                                                                                                                                                     16:35:50
ℹ .nuxt/dist/client/_nuxt/error-404.ygbHJO5Q.css    3.56 kB │ gzip:  1.11 kB                                                                                                                                                     16:35:50
ℹ .nuxt/dist/client/_nuxt/entry.DHr-p19c.css       12.40 kB │ gzip:  2.56 kB                                                                                                                                                     16:35:50
ℹ .nuxt/dist/client/_nuxt/DywpEFqs.js               3.39 kB │ gzip:  1.53 kB                                                                                                                                                     16:35:50
ℹ .nuxt/dist/client/_nuxt/Do3n5-xo.js               9.25 kB │ gzip:  3.72 kB                                                                                                                                                     16:35:50
ℹ .nuxt/dist/client/_nuxt/Dnzc7HpA.js             218.47 kB │ gzip: 62.17 kB                                                                                                                                                     16:35:50
ℹ ✓ built in 1.20s                                                                                                                                                                                                               16:35:50
✔ Client built in 1211ms                                                                                                                                                                                                         16:35:50
ℹ Building server...                                                                                                                                                                                                             16:35:50
ℹ vite v5.4.7 building SSR bundle for production...                                                                                                                                                                              16:35:50
ℹ ✓ 48 modules transformed.                                                                                                                                                                                                      16:35:50
ℹ .nuxt/dist/server/_nuxt/entry-styles.URl_9LWA.mjs             0.08 kB                                                                                                                                                          16:35:50
ℹ .nuxt/dist/server/_nuxt/error-404-styles.DRLC0U6S.mjs         0.08 kB                                                                                                                                                          16:35:50
ℹ .nuxt/dist/server/_nuxt/error-500-styles.DqmriZ_b.mjs         0.08 kB                                                                                                                                                          16:35:50
ℹ .nuxt/dist/server/_nuxt/welcome-styles.CyAsta2g.mjs           0.15 kB                                                                                                                                                          16:35:50
ℹ .nuxt/dist/server/_nuxt/error-404-styles.BcoFjqgl.mjs         0.15 kB                                                                                                                                                          16:35:50
ℹ .nuxt/dist/server/_nuxt/error-500-styles.DPP87-Dp.mjs         0.15 kB                                                                                                                                                          16:35:50
ℹ .nuxt/dist/server/styles.mjs                                  1.11 kB                                                                                                                                                          16:35:50
ℹ .nuxt/dist/server/_nuxt/error-500-styles-1.mjs-DiWYPNRc.js    2.10 kB │ map:   0.12 kB                                                                                                                                         16:35:50
ℹ .nuxt/dist/server/_nuxt/error-404-styles-1.mjs-D8Sw_W7I.js    3.80 kB │ map:   0.12 kB                                                                                                                                         16:35:50
ℹ .nuxt/dist/server/_nuxt/error-500--9hltKiR.js                 4.56 kB │ map:   5.35 kB                                                                                                                                         16:35:50
ℹ .nuxt/dist/server/_nuxt/entry-styles-1.mjs-Bf3o1wln.js       12.65 kB │ map:   0.11 kB                                                                                                                                         16:35:50
ℹ .nuxt/dist/server/_nuxt/error-404-CAZSESY4.js                15.35 kB │ map:  28.35 kB                                                                                                                                         16:35:50
ℹ .nuxt/dist/server/server.mjs                                124.47 kB │ map: 180.63 kB                                                                                                                                         16:35:50
ℹ ✓ built in 461ms                                                                                                                                                                                                               16:35:50
✔ Server built in 465ms                                                                                                                                                                                                          16:35:50
✔ Generated public .output/public                                                                                                                                                                                          nitro 16:35:50
ℹ Building Nuxt Nitro server (preset: node-server)                                                                                                                                                                         nitro 16:35:50
✔ Nuxt Nitro server built                                                                                                                                                                                                  nitro 16:35:52
  ├─ .output/server/chunks/_/error-500.mjs (4.77 kB) (2.02 kB gzip)
  ├─ .output/server/chunks/_/error-500.mjs.map (190 B) (157 B gzip)
  ├─ .output/server/chunks/build/client.manifest.mjs (1.79 kB) (426 B gzip)
  ├─ .output/server/chunks/build/client.manifest.mjs.map (1.61 kB) (370 B gzip)
  ├─ .output/server/chunks/build/entry-styles-1.mjs-Bf3o1wln.mjs (12.6 kB) (2.64 kB gzip)
  ├─ .output/server/chunks/build/entry-styles-1.mjs-Bf3o1wln.mjs.map (118 B) (116 B gzip)
  ├─ .output/server/chunks/build/entry-styles.URl_9LWA.mjs (299 B) (200 B gzip)
  ├─ .output/server/chunks/build/entry-styles.URl_9LWA.mjs.map (208 B) (163 B gzip)
  ├─ .output/server/chunks/build/error-404-CAZSESY4.mjs (15.6 kB) (4.71 kB gzip)
  ├─ .output/server/chunks/build/error-404-CAZSESY4.mjs.map (338 B) (199 B gzip)
  ├─ .output/server/chunks/build/error-404-styles-1.mjs-D8Sw_W7I.mjs (3.79 kB) (1.22 kB gzip)
  ├─ .output/server/chunks/build/error-404-styles-1.mjs-D8Sw_W7I.mjs.map (122 B) (123 B gzip)
  ├─ .output/server/chunks/build/error-404-styles.BcoFjqgl.mjs (373 B) (211 B gzip)
  ├─ .output/server/chunks/build/error-404-styles.BcoFjqgl.mjs.map (238 B) (177 B gzip)
  ├─ .output/server/chunks/build/error-404-styles.DRLC0U6S.mjs (315 B) (205 B gzip)
  ├─ .output/server/chunks/build/error-404-styles.DRLC0U6S.mjs.map (216 B) (168 B gzip)
  ├─ .output/server/chunks/build/error-500--9hltKiR.mjs (4.64 kB) (1.92 kB gzip)
  ├─ .output/server/chunks/build/error-500--9hltKiR.mjs.map (196 B) (165 B gzip)
  ├─ .output/server/chunks/build/error-500-styles-1.mjs-DiWYPNRc.mjs (2.09 kB) (834 B gzip)
  ├─ .output/server/chunks/build/error-500-styles-1.mjs-DiWYPNRc.mjs.map (122 B) (123 B gzip)
  ├─ .output/server/chunks/build/error-500-styles.DPP87-Dp.mjs (371 B) (210 B gzip)
  ├─ .output/server/chunks/build/error-500-styles.DPP87-Dp.mjs.map (238 B) (178 B gzip)
  ├─ .output/server/chunks/build/error-500-styles.DqmriZ_b.mjs (315 B) (203 B gzip)
  ├─ .output/server/chunks/build/error-500-styles.DqmriZ_b.mjs.map (216 B) (165 B gzip)
  ├─ .output/server/chunks/build/server.mjs (127 kB) (23.1 kB gzip)
  ├─ .output/server/chunks/build/server.mjs.map (2.14 kB) (588 B gzip)
  ├─ .output/server/chunks/build/styles.mjs (1.14 kB) (369 B gzip)
  ├─ .output/server/chunks/build/styles.mjs.map (709 B) (254 B gzip)
  ├─ .output/server/chunks/build/welcome-styles.CyAsta2g.mjs (362 B) (204 B gzip)
  ├─ .output/server/chunks/build/welcome-styles.CyAsta2g.mjs.map (234 B) (174 B gzip)
  ├─ .output/server/chunks/routes/renderer.mjs (14.4 kB) (4.55 kB gzip)
  ├─ .output/server/chunks/routes/renderer.mjs.map (424 B) (226 B gzip)
  ├─ .output/server/chunks/runtime.mjs (169 kB) (40.9 kB gzip)
  ├─ .output/server/chunks/runtime.mjs.map (2.95 kB) (787 B gzip)
  ├─ .output/server/chunks/virtual/_virtual_spa-template.mjs (94 B) (100 B gzip)
  ├─ .output/server/chunks/virtual/_virtual_spa-template.mjs.map (112 B) (112 B gzip)
  ├─ .output/server/index.mjs (283 B) (186 B gzip)
  └─ .output/server/package.json (586 B) (287 B gzip)
Σ Total size: 1.79 MB (426 kB gzip)
✔ You can preview this build using node .output/server/index.mjs                                                                                                                                                           nitro 16:35:52

and if you run index.mjs with deno v2.0.0-rc.4 and try to visit the page

[sheik@archlinux deno_nuxt]$ deno --version
deno 2.0.0-rc.4 (release candidate, release, x86_64-unknown-linux-gnu)
v8 12.9.202.13-rusty
typescript 5.6.2
[sheik@archlinux deno_nuxt]$ deno run -A .output/server/index.mjs
Listening on http://0.0.0.0:3000
[nuxt] [request error] [unhandled] [500] Could not load '@vue/runtime-dom' (file:///home/sheik/Documentos/deno_nuxt/.output/server/node_modules/@vue/runtime-dom/index.js) referenced from file:///home/sheik/Documentos/deno_nuxt/.output/server/node_modules/vue/dist/vue.cjs.js
  Caused by:
    No such file or directory (os error 2)
  at async Object.handler (./.output/server/chunks/runtime.mjs:2884:19)  
  at async ServerImpl.toNodeHandle (./.output/server/chunks/runtime.mjs:3154:7)
[nuxt] [request error] [unhandled] [500] Could not load '@vue/runtime-dom' (file:///home/sheik/Documentos/deno_nuxt/.output/server/node_modules/@vue/runtime-dom/index.js) referenced from file:///home/sheik/Documentos/deno_nuxt/.output/server/node_modules/vue/dist/vue.cjs.js
  Caused by:
    No such file or directory (os error 2)
  at async Object.handler (./.output/server/chunks/runtime.mjs:2884:19)  
  at async toNodeHandle (./.output/server/chunks/runtime.mjs:3154:7)  
  at async ufetch (./.output/server/chunks/runtime.mjs:3572:17)  
  at async errorhandler (./.output/server/chunks/runtime.mjs:5242:41)  
  at async ServerImpl.toNodeHandle (./.output/server/chunks/runtime.mjs:3162:9)

But if you run it with Deno v1.46.3 it works fine

[sheik@archlinux deno_nuxt]$ deno --version
deno 1.46.3 (stable, release, x86_64-unknown-linux-gnu)
v8 12.9.202.5-rusty
typescript 5.5.2
[sheik@archlinux deno_nuxt]$ deno run -A .output/server/index.mjs
Listening on http://0.0.0.0:3000
nathanwhit commented 1 month ago

Fixed by https://github.com/denoland/deno/pull/25785.

This should now be working on canary (deno upgrade canary).

Try it out and feel free to reopen if you still encounter issues