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

@nuxtjs/i18n Cannot find module on Next3 build #2174

Closed
matvejs16 opened this issue Jun 21, 2023 · 5 comments · Fixed by #2199
Closed

@nuxtjs/i18n Cannot find module on Next3 build #2174

matvejs16 opened this issue Jun 21, 2023 · 5 comments · Fixed by #2199
Labels
config locale nitro ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf prerender v8

Comments

@matvejs16
Copy link

Environment

------------------------------
- Operating System: Windows_NT
- Node Version:     v18.15.0
- Nuxt Version:     3.5.3
- Nitro Version:    2.4.1
- Package Manager:  [email protected]
- Builder:          vite
- User Config:      devtools, modules, components, webpack, sourcemap, ssr, typescript, pinia, i18n, pwa, app
- Runtime Modules:  @nuxtjs/[email protected], @pinia/[email protected], @kevinmarrec/[email protected]
- Build Modules:    -
------------------------------

Reproduction

https://stackblitz.com/edit/github-bkh9xq?file=nuxt.config.ts

Describe the bug

Getting error:

[22:12:53]  ERROR  [nuxt] [request error] [unhandled] [500] Cannot find module 'E:\Coding Scripts\Coding Scripts\Vue\Nuxt\github-bkh9xq\dist\server\_nuxt\nuxt-i18n-db2f3d98.js' imported from E:\Coding Scripts\Vue\Nuxt\github-bkh9xq\.nuxt\prerender\chunks\nitro\nitro-prerenderer.mjs
  at new NodeError (node:internal/errors:399:5)
  at finalizeResolution (node:internal/modules/esm/resolve:326:11)
  at moduleResolve (node:internal/modules/esm/resolve:945:10)
  at defaultResolve (node:internal/modules/esm/resolve:1153:11)
  at nextResolve (node:internal/modules/esm/loader:163:28)
  at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
  at ESMLoader.import (node:internal/modules/esm/loader:525:22)
  at importModuleDynamically (node:internal/modules/esm/translators:110:35)
  at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)

  ├─ /__i18n__/prerender/108541b1.js (68ms) (Error: [500] )                                             nitro 22:12:53

Additional context

Only on my setup, in minimal reproduction everything is good.

Logs

E:\Coding Scripts\Vue\Nuxt\github-bkh9xq>npm run build

> build
> nuxt build

Nuxi 3.5.3                                                                                                    22:12:45
Nuxt 3.5.3 with Nitro 2.5.0                                                                                   22:12:45

[@nuxtjs/i18n 22:12:46]  WARN  i18n:extend-messages is deprecated. That hook will be removed feature at the time of the v8 official release.
If you're using it, please use i18n:registerModule instead.


 WARN  [PWA] Icon not found at E:/Coding Scripts/Vue/Nuxt/github-bkh9xq/public/icon.png                       22:12:46

ℹ Building client...                                                                                          22:12:47
ℹ vite v4.3.9 building for production...                                                                      22:12:48
ℹ ✓ 127 modules transformed.                                                                                  22:12:49
rendering chunks (4)...(nuxtjs:i18n-resource-dynamic plugin) Sourcemap is likely to be incorrect: a plugin (nuxtjs:i18n-resource-dynamic) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
ℹ .nuxt/dist/client/i18n-meta.json                       0.09 kB │ gzip:  0.09 kB                             22:12:50
ℹ .nuxt/dist/client/manifest.json                        3.16 kB │ gzip:  0.59 kB                             22:12:50
ℹ .nuxt/dist/client/_nuxt/error-500.aa16ed4d.css         1.95 kB │ gzip:  0.74 kB                             22:12:50
ℹ .nuxt/dist/client/_nuxt/error-404.23f2309d.css         3.63 kB │ gzip:  1.12 kB                             22:12:50
ℹ .nuxt/dist/client/_nuxt/entry.bbc96c86.css            12.13 kB │ gzip:  2.49 kB                             22:12:50
ℹ .nuxt/dist/client/_nuxt/en.06e65bab.js                 0.12 kB │ gzip:  0.14 kB │ map:     0.26 kB          22:12:50
ℹ .nuxt/dist/client/_nuxt/nuxt-i18n.4dde3546.js          0.49 kB │ gzip:  0.35 kB │ map:     0.10 kB          22:12:50
ℹ .nuxt/dist/client/_nuxt/i18n.options.cb570dcb.js       0.49 kB │ gzip:  0.33 kB │ map:     0.11 kB          22:12:50
ℹ .nuxt/dist/client/_nuxt/error-component.32f4f92a.js    1.17 kB │ gzip:  0.64 kB │ map:     2.74 kB          22:12:50
ℹ .nuxt/dist/client/_nuxt/error-500.cb54a19b.js          1.93 kB │ gzip:  1.02 kB │ map:     3.72 kB          22:12:50
ℹ .nuxt/dist/client/_nuxt/error-404.d011374e.js          6.55 kB │ gzip:  2.91 kB │ map:    24.12 kB          22:12:50
ℹ .nuxt/dist/client/_nuxt/entry.1c5dab5a.js            255.30 kB │ gzip: 74.42 kB │ map: 1,472.91 kB          22:12:50
ℹ ✓ built in 2.05s                                                                                            22:12:50
✔ Client built in 2057ms                                                                                      22:12:50
ℹ Building server...                                                                                          22:12:50
ℹ vite v4.3.9 building SSR bundle for production...                                                           22:12:50
ℹ ✓ 77 modules transformed.                                                                                   22:12:50
rendering chunks (11)...(nuxtjs:i18n-resource-dynamic plugin) Sourcemap is likely to be incorrect: a plugin (nuxtjs:i18n-resource-dynamic) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
ℹ .nuxt/dist/server/_nuxt/welcome-styles.dc3a70c6.mjs           0.08 kB                                       22:12:51
ℹ .nuxt/dist/server/_nuxt/error-404-styles.a5c3f351.mjs         0.08 kB                                       22:12:51
ℹ .nuxt/dist/server/_nuxt/error-500-styles.6b5b5ff2.mjs         0.08 kB                                       22:12:51
ℹ .nuxt/dist/server/i18n-meta.json                              0.09 kB                                       22:12:51
ℹ .nuxt/dist/server/styles.mjs                                  0.49 kB                                       22:12:51
ℹ .nuxt/dist/server/_nuxt/en-0bccf81f.js                        0.20 kB │ map:   0.27 kB                      22:12:51
ℹ .nuxt/dist/server/_nuxt/nuxt-i18n-db2f3d98.js                 1.04 kB │ map:   0.14 kB                      22:12:51
ℹ .nuxt/dist/server/_nuxt/island-renderer-9d657a32.js           1.25 kB │ map:   1.42 kB                      22:12:51
ℹ .nuxt/dist/server/_nuxt/i18n.options-e4f80e75.js              1.46 kB │ map:   0.15 kB                      22:12:51
ℹ .nuxt/dist/server/_nuxt/error-component-4ea95c75.js           2.04 kB │ map:   2.71 kB                      22:12:51
ℹ .nuxt/dist/server/_nuxt/error-500-styles-1.mjs-0a86f27a.js    2.17 kB │ map:   0.12 kB                      22:12:51
ℹ .nuxt/dist/server/_nuxt/error-dev-styles-1.mjs-90bc7cbc.js    2.46 kB │ map:   0.12 kB                      22:12:51
ℹ .nuxt/dist/server/_nuxt/error-500-7b7223e6.js                 3.22 kB │ map:   3.79 kB                      22:12:51
ℹ .nuxt/dist/server/_nuxt/error-404-styles-1.mjs-6ef6e240.js    3.86 kB │ map:   0.12 kB                      22:12:51
ℹ .nuxt/dist/server/_nuxt/error-404-e9ac9f0f.js                 9.84 kB │ map:  18.88 kB                      22:12:51
ℹ .nuxt/dist/server/_nuxt/welcome-styles-1.mjs-bfad4fc1.js     12.38 kB │ map:   0.11 kB                      22:12:51
ℹ .nuxt/dist/server/server.mjs                                257.13 kB │ map: 540.95 kB                      22:12:51
ℹ ✓ built in 1.81s                                                                                            22:12:51
✔ Server built in 1958ms                                                                                      22:12:52
✔ Generated public .output/public                                                                       nitro 22:12:52
ℹ Initializing prerenderer                                                                              nitro 22:12:52
ℹ Prerendering 1 routes                                                                                 nitro 22:12:53

[22:12:53]  ERROR  [nuxt] [request error] [unhandled] [500] Cannot find module 'E:\Coding Scripts\Coding Scripts\Vue\Nuxt\github-bkh9xq\dist\server\_nuxt\nuxt-i18n-db2f3d98.js' imported from E:\Coding Scripts\Vue\Nuxt\github-bkh9xq\.nuxt\prerender\chunks\nitro\nitro-prerenderer.mjs
  at new NodeError (node:internal/errors:399:5)
  at finalizeResolution (node:internal/modules/esm/resolve:326:11)
  at moduleResolve (node:internal/modules/esm/resolve:945:10)
  at defaultResolve (node:internal/modules/esm/resolve:1153:11)
  at nextResolve (node:internal/modules/esm/loader:163:28)
  at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
  at ESMLoader.import (node:internal/modules/esm/loader:525:22)
  at importModuleDynamically (node:internal/modules/esm/translators:110:35)
  at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)

  ├─ /__i18n__/prerender/108541b1.js (68ms) (Error: [500] )                                             nitro 22:12:53
ℹ Building Nitro Server (preset: node-server)                                                           nitro 22:12:53
✔ Nitro server built                                                                                    nitro 22:12:58
  ├─ .output/server/chunks/app/_nuxt/en-0bccf81f.mjs (199 B) (169 B gzip)
  ├─ .output/server/chunks/app/_nuxt/en-0bccf81f.mjs.map (360 B) (251 B gzip)
  ├─ .output/server/chunks/app/_nuxt/error-404-e9ac9f0f.mjs (10.1 kB) (3.22 kB gzip)
  ├─ .output/server/chunks/app/_nuxt/error-404-e9ac9f0f.mjs.map (8.04 kB) (1.98 kB gzip)
  ├─ .output/server/chunks/app/_nuxt/error-404-styles.a5c3f351.mjs (3.92 kB) (1.25 kB gzip)
  ├─ .output/server/chunks/app/_nuxt/error-404-styles.a5c3f351.mjs.map (376 B) (238 B gzip)
  ├─ .output/server/chunks/app/_nuxt/error-500-7b7223e6.mjs (3.41 kB) (1.49 kB gzip)
  ├─ .output/server/chunks/app/_nuxt/error-500-7b7223e6.mjs.map (1.71 kB) (627 B gzip)
  ├─ .output/server/chunks/app/_nuxt/error-500-styles.6b5b5ff2.mjs (2.22 kB) (864 B gzip)
  ├─ .output/server/chunks/app/_nuxt/error-500-styles.6b5b5ff2.mjs.map (376 B) (237 B gzip)
  ├─ .output/server/chunks/app/_nuxt/error-component-4ea95c75.mjs (2.07 kB) (902 B gzip)
  ├─ .output/server/chunks/app/_nuxt/error-component-4ea95c75.mjs.map (2.41 kB) (827 B gzip)
  ├─ .output/server/chunks/app/_nuxt/i18n.options-e4f80e75.mjs (1.58 kB) (712 B gzip)
  ├─ .output/server/chunks/app/_nuxt/i18n.options-e4f80e75.mjs.map (1.04 kB) (471 B gzip)
  ├─ .output/server/chunks/app/_nuxt/island-renderer-9d657a32.mjs (1.52 kB) (678 B gzip)
  ├─ .output/server/chunks/app/_nuxt/island-renderer-9d657a32.mjs.map (944 B) (459 B gzip)
  ├─ .output/server/chunks/app/_nuxt/nuxt-i18n-db2f3d98.mjs (1.04 kB) (479 B gzip)
  ├─ .output/server/chunks/app/_nuxt/nuxt-i18n-db2f3d98.mjs.map (1.29 kB) (501 B gzip)
  ├─ .output/server/chunks/app/_nuxt/welcome-styles.dc3a70c6.mjs (12.4 kB) (2.6 kB gzip)
  ├─ .output/server/chunks/app/_nuxt/welcome-styles.dc3a70c6.mjs.map (370 B) (236 B gzip)
  ├─ .output/server/chunks/app/client.manifest.mjs (3.85 kB) (706 B gzip)
  ├─ .output/server/chunks/app/client.manifest.mjs.map (2.65 kB) (566 B gzip)
  ├─ .output/server/chunks/app/server.mjs (221 kB) (44.6 kB gzip)
  ├─ .output/server/chunks/app/server.mjs.map (140 kB) (20.7 kB gzip)
  ├─ .output/server/chunks/app/styles.mjs (558 B) (263 B gzip)
  ├─ .output/server/chunks/app/styles.mjs.map (458 B) (247 B gzip)
  ├─ .output/server/chunks/error-500.mjs (4.26 kB) (1.82 kB gzip)
  ├─ .output/server/chunks/error-500.mjs.map (1.09 kB) (415 B gzip)
  ├─ .output/server/chunks/handlers/renderer.mjs (9.98 kB) (3.14 kB gzip)
  ├─ .output/server/chunks/handlers/renderer.mjs.map (11.2 kB) (2.27 kB gzip)
  ├─ .output/server/chunks/nitro/node-server.mjs (36.3 kB) (10.3 kB gzip)
  ├─ .output/server/chunks/nitro/node-server.mjs.map (124 kB) (8.56 kB gzip)
  ├─ .output/server/chunks/rollup/_virtual_head-static.mjs (1.43 kB) (552 B gzip)
  ├─ .output/server/chunks/rollup/_virtual_head-static.mjs.map (111 B) (112 B gzip)
  ├─ .output/server/index.mjs (602 B) (308 B gzip)
  └─ .output/server/package.json (2.55 kB) (902 B gzip)
Σ Total size: 6.41 MB (1.46 MB gzip)
✔ You can preview this build using node .output/server/index.mjs                                        nitro 22:12:59
@marr
Copy link

marr commented Jun 22, 2023

I have a minimal reproduction of this https://github.com/marr/nuxt3-module
you will have to npm install and npm run test to see it.

The concerning warnings/errors include:

(nuxtjs:i18n-resource-dynamic plugin) Sourcemap is likely to be incorrect: a plugin (nuxtjs:i18n-resource-dynamic) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help

and

[error] [nuxt] [request error] [unhandled] [500] Cannot find module '/Users/david.marr/playground/nuxt3-module/test/fixtures/basic/.nuxt/dist/server/_nuxt/i18n.config-10913fc7.js' imported from /Users/david.marr/playground/nuxt3-module/test/fixtures/basic/.nuxt/n5nk6e/prerender/chunks/nitro/nitro-prerenderer.mjs
at new NodeError (node:internal/errors:399:5)
at finalizeResolution (node:internal/modules/esm/resolve:326:11)
at moduleResolve (node:internal/modules/esm/resolve:945:10)
at defaultResolve (node:internal/modules/esm/resolve:1153:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)

@Redjaw
Copy link

Redjaw commented Jun 23, 2023

I do have the same issue when generating with ssr: false

@matvejs16
Copy link
Author

I do have the same issue when generating with ssr: false

I'm building with ssr: true

@kazupon kazupon added v8 ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf and removed pending triage labels Jun 24, 2023 — with Volta.net
Copy link
Collaborator

kazupon commented Jun 24, 2023

related issue, #2029, #2170, #2086
I'm working on vue-i18n, to solve the underlying issue.
intlify/vue-i18n#1434

When i18n resources will be dynamically compiled in that PR, nuxt i18n will also be resolved around issues.
Please wait.

@matvejs16
Copy link
Author

I'm using @nuxtjs/i18n package and there is no updates for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config locale nitro ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf prerender v8
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants