在我的Nuxt.js应用程序中,我按照文档的建议安装了nuxt-i18n:
{
modules: [
['nuxt-i18n', {
// Options
}]
]
}但是,当我运行npm时,我会得到以下错误消息:
DONE Compiled successfully in -4519ms 12:53:52
OPEN http://localhost:3000
nuxt:render Rendering url / +0ms
{ statusCode: 404,
path: '/',
message: 'This page could not be found' } 怎么解决这个问题?
发布于 2018-09-27 12:29:18
如果您设置了默认的区域设置:)
modules: [
['nuxt-i18n', {
locales: ['en', 'fr', 'es'],
defaultLocale: 'en',
seo: false // workaround to fix the current issue on module https://github.com/nuxt-community/nuxt-i18n/issues/127
}]
],发布于 2018-09-27 13:02:51
为了完成@Nicolas Pennec -伟大的答案,并且为了避免像下面这样的警告消息:Locale ISO code is required to generate alternate link,我们应该按照文档中描述的那样声明区域设置。
// nuxt.config.js
['nuxt-i18n', {
locales: [
{
code: 'en',
iso: 'en-US'
},
{
code: 'es',
iso: 'es-ES'
},
{
code: 'fr',
iso: 'fr-FR'
}
]
}]https://stackoverflow.com/questions/52534308
复制相似问题