i18n: Missing i18n options file with `npm run generate`

Environment

  • Operating System: Linux
  • Node Version: v16.14.2
  • Nuxt Version: 3.4.1
  • Nitro Version: 2.3.3
  • Package Manager: npm@7.17.0
  • Builder: vite
  • User Config: modules, i18n
  • Runtime Modules: @nuxtjs/i18n-edge@8.0.0-beta.11-28023078.39cf21b
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-6ylvpz

run npm i && npm run generate && serve .output/public

Describe the bug

When the nuxt project is built with npm run generate the generated build will crash and throw error 500 with error message format is not defined. When you check the network tab in the developer tools you will see that the i18n-config-[hash].js file will not exist status 404 is returned.

Bildschirmfoto 2023-04-13 um 16 07 18

Additional context

No response

Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 29 (1 by maintainers)

Most upvoted comments

I’m working on this issue.

The reason is taking a little time is because our main day job DEADLINE, is coming up at the end of this month.

Please assured that this issue is not being ignored at all and wait. 🙏

Still should be seen as a workaround. Default should run out of the box without messing with those rights (imho).

Workaround: Roll back to v8.0.0-beta.10 (which requires to revert the config file change to an object notation). Once it’s fixed, the config file can be used again.

Still there seems to be a problem with nuxt generate. The config file does not end up in the build. Please check the reproduction instructions. However, I also noticed that with nuxt build there was also a 404 client side for this file. But the website did not crash. It looks like resolving this server side works fine, but there is something wrong client side.

I am also facing this issue with the latest beta version (12) Here is the relevant logs from my vercel deployment:

@nuxtjs/i18n Cannot find module '/var/public/__i18n__/prerender/924d8e8b.js' imported from /var/task/chunks/app/_nuxt/i18n.options-3b873373.mjs

This is also happening to me when I try to deploy to Vercel.

When I run nuxt build locally, the .nuxt/i18n folder and the config file aren’t automatically generated until I refresh my browser.

Here is my .nuxt folder after running nuxt build: image

And here it is again after I run the build server using node .output/server/index.mjs and refreshing localhost: image

But in Vercel it just crashes beforehand since it can’t find the config file: image

Please reproduction repo or stackbliz 🙏

See here: https://stackblitz.com/edit/github-cr1uk5-mr8fcr?file=package.json Thanks!

I’ve fixed this issue. Please check edge channel 8.0.0-beta.11-28059008.d1499b6 version. Thanks!

I’m getting a different error now when I try to build the project with npx nuxi generate:

[4:42:41 PM]  ERROR  [nuxtjs:i18n-resource-dynamic] Plugin error - Unable to get file name for unknown file "6b5f3ecd".
[4:42:41 PM] ℹ ✓ built in 12ms
[4:42:41 PM]  ERROR  Plugin error - Unable to get file name for unknown file "6b5f3ecd".
  at error (node_modules/rollup/dist/es/shared/node-entry.js:2125:30)
  at FileEmitter.getFileName (node_modules/rollup/dist/es/shared/node-entry.js:24128:24)
  at node_modules/@nuxtjs/i18n/dist/module.mjs:1216:50
  at Array.reduce (<anonymous>)
  at Object.generateBundle (node_modules/@nuxtjs/i18n/dist/module.mjs:1215:44)
  at node_modules/rollup/dist/es/shared/node-entry.js:24551:40
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I’ve fixed this issue. Please check edge channel 8.0.0-beta.11-28059008.d1499b6 version. Thanks!

We have the same problem. It seems to be new in beta11 since beta10 doesn’t have that problem (However it has another problem).