i18n: [NEXT] Cannot start nuxt: Cannot find module 'node_modules/vue-i18n/dist/vue-i18n.mjs'

Hi,

I’m currently using vue-i18n as a plugin in a Nuxt 3 project but I would like to switch to @nuxtjs/i18n as soon as possible. I tried to installed the alpha version but as soon as I declare the module in nuxt.config.js, I’ve got an error when I do npm run dev.

Cannot find module '.../node_modules/vue-i18n/dist/vue-i18n.mjs'

  at createEsmNotFoundErr (node:internal/modules/cjs/loader:983:15)
  at finalizeEsmResolution (node:internal/modules/cjs/loader:976:15)
  at resolveExports (node:internal/modules/cjs/loader:493:14)
  at Function.Module._findPath (node:internal/modules/cjs/loader:533:31)
  at Function.Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
  at Function.resolve (node:internal/modules/cjs/helpers:108:19)
  at Function._resolve [as resolve] (node_modules/jiti/dist/jiti.js:1:243257)
  at resolveModule (node_modules/@nuxt/kit/dist/index.mjs:261:29)
  at setupAlias (node_modules/@nuxtjs/i18n/dist/module.mjs:25:36)
  at setup (node_modules/@nuxtjs/i18n/dist/module.mjs:541:11)
  at async Object.normalizedModule (node_modules/@nuxt/kit/dist/index.mjs:642:5)
  at async installModule (node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:456:3)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:1606:7)
  at async load (node_modules/nuxi/dist/chunks/dev.mjs:6778:9)
  at async Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6828:5)
  at async _main (node_modules/nuxi/dist/cli.mjs:50:20)

Indeed there is no such file in node_modules/vue-i18n/dist/ Any help will be appreciated!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 28

Most upvoted comments

I think I solved the issue, with defining the override within package.json for now:

"overrides": {
  "vue-i18n": "^9.3.0-beta.14"
}

Hi, I have the same problem on a fresh nuxt3 project :

500 [vite-node] [ERR_MODULE_NOT_FOUND] /node_modules/dist/vue-i18n.mjs

@Cyclodex my npm ls vue-i18n is :

├─┬ @nuxtjs/i18n@8.0.0-beta.7
│ ├─┬ @intlify/unplugin-vue-i18n@0.8.1
│ │ └── vue-i18n@9.2.2 deduped
│ ├─┬ vue-i18n-routing@0.10.2
│ │ ├─┬ @intlify/vue-i18n-bridge@0.8.0
│ │ │ └── vue-i18n@9.3.0-beta.14-77e850b deduped
│ │ └── vue-i18n@9.3.0-beta.14-77e850b deduped
│ └── vue-i18n@9.3.0-beta.14-77e850b
└─┬ vuetify@3.1.0
  └── vue-i18n@9.2.2

==========

EDIT : Thanks @Cyclodex, using “^9.3.0-beta.14” work great. Now my npm ls vue-i18n is :

├─┬ @nuxtjs/i18n@8.0.0-beta.7
│ ├─┬ @intlify/unplugin-vue-i18n@0.8.1
│ │ └── vue-i18n@9.3.0-beta.14-77e850b deduped invalid: "^9.0.0" from node_modules/vuetify
│ ├─┬ vue-i18n-routing@0.10.2
│ │ ├─┬ @intlify/vue-i18n-bridge@0.8.0
│ │ │ └── vue-i18n@9.3.0-beta.14-77e850b deduped invalid: "^9.0.0" from node_modules/vuetify
│ │ └── vue-i18n@9.3.0-beta.14-77e850b deduped invalid: "^9.0.0" from node_modules/vuetify                                                                                         10:08:19
│ └── vue-i18n@9.3.0-beta.14-77e850b deduped
├── vue-i18n@9.3.0-beta.14-77e850b
└─┬ vuetify@3.1.0
  └── vue-i18n@9.3.0-beta.14-77e850b deduped invalid: "^9.0.0" from node_modules/vuetify

@kazupon No worries for the delay and thank you but you closed this thread based on the second error I mentioned. I tried again on a new project and yes the Cannot read properties of undefined (reading 'path') error is gone but not the Cannot find module '.../node_modules/vue-i18n/dist/vue-i18n.mjs' I declared for this thread when trying to install @nuxti18n in a project already working.

I can’t share my project but maybe @ahoiroman , @LePtiDev or @smartfox87 have an example they can share please?

Otherwise I’ll try to reproduce on a fresh project when I have some time, but I just saw that in a new project the vue-i18n.msj is there but not on my current project even if I’m doing the same command and config!