ERROR Cannot restart nuxt: input.replace is not a function

更新于2024-11-05 08:01:004 分钟2 千字2233949800
摘要

问题描述


ERROR  Cannot restart nuxt:  input.replace is not a function                                             22:03:25

  at normalizeWindowsPath (node_modules/pathe/dist/shared/pathe.ff20891b.mjs:6:16)
  at normalize (node_modules/pathe/dist/shared/pathe.ff20891b.mjs:19:10)
  at resolvePath (node_modules/@nuxt/kit/dist/index.mjs:2340:10)
  at resolveVueI18nConfigInfo (node_modules/@nuxtjs/i18n/dist/module.mjs:329:30)
  at node_modules/@nuxtjs/i18n/dist/module.mjs:799:23
  at Array.map (<anonymous>)
  at resolveLayerVueI18nConfigInfo (node_modules/@nuxtjs/i18n/dist/module.mjs:797:43)
  at setup (node_modules/@nuxtjs/i18n/dist/module.mjs:1864:38)
  at async normalizedModule (node_modules/@nuxt/kit/dist/index.mjs:2136:17)
  at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2478:95)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:4506:5)
  at async NuxtDevServer._load (node_modules/nuxi/dist/chunks/dev2.mjs:1893:5)
  at async NuxtDevServer.load (node_modules/nuxi/dist/chunks/dev2.mjs:1828:7)
  at async _applyPromised (node_modules/nuxi/dist/chunks/dev2.mjs:107:10)

解决方案

// 新建i18n.config{.js,.mjs,.ts}

export default {
  locales: [
    { code: 'zh-CN', name: '简体中文', file: 'zh-CN.json' },
    { code: 'zh-TW', name: '繁體中文', file: 'zh-TW.json' },
    { code: 'en', name: 'English', file: 'en.json' }
  ],
  lazy: true,
  langDir: '~/locales/languages/',
  vueI18n: {
    legacy: false,
    fallbackLocale: 'zh-CN',
    locale: 'zh-CN'
  },
  defaultLocale: 'zh-CN',
  strategy: 'no_prefix'
}
// nuxt.config.js配置
  i18n: {
    vueI18n: './nuxt-i18n.js' // custom path example
  },

参考链接

https://v8.i18n.nuxtjs.org/options/vue-i18n

评论区

你认为这篇文章怎么样?
  • great
    0
  • happy
    0
  • doubt
    0
  • boring
    0
  • bad
    0

0/2048