【问题标题】:Error while initializing app TypeError: parentVal.concat is not a function初始化应用程序 TypeError 时出错:parentVal.concat 不是函数
【发布时间】:2018-09-27 11:44:52
【问题描述】:

我创建了一个新的 Nuxt.js 项目:npx create-nuxt-app project

然后我启动服务器:cd project && npm run dev 到此为止一切正常。

现在我想安装nuxt-i18n:npm i nuxt-i18n 然后我在nuxt.config.js中添加了它:

modules: [
    ['nuxt-i18n', {
      // Options
    }]

我在开发工具的控制台中收到以下错误(页面显示空白):

app.js:455 [nuxt] Error while initializing app TypeError: parentVal.concat is not a function
    at mergeHook (commons.app.js:11924)
    at mergeField (commons.app.js:12185)
    at mergeOptions (commons.app.js:12176)
    at Vue._init (commons.app.js:15301)
    at new Vue (commons.app.js:15419)
    at _callee5$ (app.js:1317)
    at tryCatch (commons.app.js:5854)
    at Generator.invoke [as _invoke] (commons.app.js:6088)
    at Generator.prototype.(:3000/anonymous function) [as next] (http://localhost:3000/_nuxt/commons.app.js:5906:21)
    at asyncGeneratorStep (commons.app.js:33)

是什么原因造成的,如何解决?

【问题讨论】:

    标签: javascript nuxt.js nuxt-i18n


    【解决方案1】:

    这似乎是由于 vue-i18n 使用的 vue-meta 的子依赖问题造成的 (请参阅未解决的问题https://github.com/nuxt-community/nuxt-i18n/issues/127

    作为解决方法,尝试将 seo 选项设置为 false :

    // nuxt.config.js
    
    ['nuxt-i18n', {
      seo: false
    }]
    

    【讨论】:

    • 我之前尝试过该选项,但没有成功。为努力+1
    • 正确,我也尝试了“seo”选项。它不起作用:-/我们必须等待模块的修复。
    【解决方案2】:

    这是由于 vue-meta. Vue-meta 1.5.5 已发布,已修复此问题。 所以你可以更新它,它会没事的

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-08-06
      • 2018-03-06
      • 2017-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-25
      相关资源
      最近更新 更多