nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.71k stars 478 forks source link

input.replace is not a function #2816

Closed mamboer closed 7 months ago

mamboer commented 7 months ago

Environment

------------------------------
- Operating System: Darwin
- Node Version:     v20.10.0
- Nuxt Version:     3.10.2
- CLI Version:      3.10.0
- Nitro Version:    2.8.1
- Package Manager:  yarn@1.22.21
- Builder:          -
- User Config:      devtools, modules, ui, app, content, googleFonts, i18n
- Runtime Modules:  @nuxtjs/i18n@8.1.1, @nuxt/ui@2.13.0, nuxt-icon@0.6.8, @nuxtjs/google-fonts@3.1.3, @nuxtjs/fontaine@0.4.1, @nuxt/image@1.3.0, @nuxt/content@2.12.0, @nuxthq/studio@1.0.11, @vueuse/nuxt@10.8.0
- Build Modules:    -
------------------------------

Reproduction

https://github.com/mamboer/huangyongyou.cn

Describe the bug

Following the https://i18n.nuxtjs.org/docs/getting-started, when run the yarn dev command, it throws the error as below:

 ERROR  Cannot start nuxt:  input.replace is not a function         2:31:18 PM

  at normalizeWindowsPath (node_modules/@nuxt/kit/node_modules/pathe/dist/shared/pathe.ff20891b.mjs:6:16)
  at normalize (node_modules/@nuxt/kit/node_modules/pathe/dist/shared/pathe.ff20891b.mjs:19:10)
  at resolvePath (node_modules/@nuxt/kit/dist/index.mjs:2311:10)
  at resolveVueI18nConfigInfo (node_modules/@nuxtjs/i18n/dist/module.mjs:299:30)
  at node_modules/@nuxtjs/i18n/dist/module.mjs:692:28
  at Array.map (<anonymous>)
  at resolveLayerVueI18nConfigInfo (node_modules/@nuxtjs/i18n/dist/module.mjs:690:16)
  at setup (node_modules/@nuxtjs/i18n/dist/module.mjs:1531:38)
  at async normalizedModule (node_modules/@nuxt/kit/dist/index.mjs:2112:17)
  at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2415:95)

Additional context

No response

Logs

No response

YevgeniyShek commented 7 months ago

Hi, @mamboer!

Probably you should retrieve the value of vueI18n from nuxt config

    vueI18n: {
      fallbackLocale: "en",
    },

into a separate file and wrap it with defineI18nConfig call.

Check the Getting Started -> Usage

Edited: Moving to a separate file might be optional, it's better to check

mamboer commented 7 months ago

@YevgeniyShek It works, thanks!