Nuxt 2.5.0 + Firebase - 未找到依赖项

Posted

技术标签:

【中文标题】Nuxt 2.5.0 + Firebase - 未找到依赖项【英文标题】:Nuxt 2.5.0 + Firebase - dependencies were not found 【发布时间】:2019-08-12 15:17:44 【问题描述】:

我一直在 Nuxt 中使用 firebase,但在升级 2.5.0 时出现了这些错误。似乎无法弄清楚问题所在?

 ERROR  Failed to compile with 7 errors                                                                           friendly-errors 13:21:54

These dependencies were not found:                                                                                friendly-errors 13:21:54
                                                                                                                  friendly-errors 13:21:54
* core-js/fn/array/find in ./node_modules/@firebase/polyfill/dist/index.esm.js                                    friendly-errors 13:21:54
* core-js/fn/array/find-index in ./node_modules/@firebase/polyfill/dist/index.esm.js                              friendly-errors 13:21:54
* core-js/fn/object/assign in ./node_modules/@firebase/polyfill/dist/index.esm.js                                 friendly-errors 13:21:54
* core-js/fn/string/repeat in ./node_modules/@firebase/polyfill/dist/index.esm.js                                 friendly-errors 13:21:54
* core-js/fn/string/starts-with in ./node_modules/@firebase/polyfill/dist/index.esm.js                            friendly-errors 13:21:54
* core-js/fn/symbol in ./node_modules/@firebase/polyfill/dist/index.esm.js                                        friendly-errors 13:21:54
* core-js/fn/symbol/iterator in ./node_modules/@firebase/polyfill/dist/index.esm.js                               friendly-errors 13:21:54
                                                                                                                  friendly-errors 13:21:54
To install them, you can run: npm install --save core-js/fn/array/find core-js/fn/array/find-index core-js/fn/object/assign core-js/fn/string/repeat core-js/fn/string/starts-with core-js/fn/symbol core-js/fn/symbol/iterator

【问题讨论】:

等待 nuxt 2.5.1 中的修补程序 【参考方案1】:
npm install core-js@2.6.10

解决问题

"dependencies": 
    "@nuxtjs/auth": "^4.9.1",
    "@nuxtjs/axios": "^5.10.3",
    "@nuxtjs/firebase": "^5.0.7",
    "core-js": "2.6.10",
    "firebase": "^7.14.2",
    "nuxt": "^2.12.2"
  ,
  "devDependencies": 
    "@nuxtjs/vuetify": "^1.11.2"
  

【讨论】:

【参考方案2】:

我有这个确切的问题。

* core-js/modules/es6.array.find in ./.nuxt/client.js                      friendly-errors 20:39:58
* core-js/modules/es6.array.iterator in ./.nuxt/client.js                  friendly-errors 20:39:58
* core-js/modules/es6.date.to-string in ./.nuxt/utils.js, ./.nuxt/components/nuxt.js
* core-js/modules/es6.function.name in ./.nuxt/client.js                   friendly-errors 20:39:58
* core-js/modules/es6.object.assign in ./.nuxt/client.js                   friendly-errors 20:39:58
* core-js/modules/es6.object.keys in ./.nuxt/client.js                     friendly-errors 20:39:58
* core-js/modules/es6.object.to-string in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
* core-js/modules/es6.promise in ./.nuxt/client.js                         friendly-errors 20:39:58
* core-js/modules/es6.regexp.constructor in ./.nuxt/utils.js               friendly-errors 20:39:58
* core-js/modules/es6.regexp.match in ./.nuxt/client.js                    friendly-errors 20:39:58
* core-js/modules/es6.regexp.replace in ./.nuxt/utils.js, ./.nuxt/components/nuxt.js
* core-js/modules/es6.regexp.search in ./.nuxt/utils.js                    friendly-errors 20:39:58
* core-js/modules/es6.regexp.split in ./.nuxt/utils.js, ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./.nuxt/components/nuxt-build-indicator.vue?vue&type=script&lang=js& and 1 other
* core-js/modules/es6.regexp.to-string in ./.nuxt/utils.js, ./.nuxt/components/nuxt.js
* core-js/modules/es6.string.includes in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
* core-js/modules/es6.string.iterator in ./.nuxt/client.js                 friendly-errors 20:39:58
* core-js/modules/es6.string.repeat in ./.nuxt/utils.js                    friendly-errors 20:39:58
* core-js/modules/es6.string.starts-with in ./.nuxt/utils.js               friendly-errors 20:39:58
* core-js/modules/es6.symbol in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
* core-js/modules/es7.array.includes in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
* core-js/modules/es7.object.get-own-property-descriptors in ./.nuxt/index.js
* core-js/modules/es7.promise.finally in ./.nuxt/client.js                 friendly-errors 20:39:58
* core-js/modules/es7.symbol.async-iterator in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
* core-js/modules/web.dom.iterable in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js

问题是,我正在运行 nuxt 2.11。

【讨论】:

我认为它最终成为了 package-lock.json 文件。确保删除它并重新安装。 firebase 默认使用的 core-js 版本似乎与 cordova 不同。发生版本不匹配,然后发生这种混乱。由于 cordova 与 webview 一起使用,我改为在 webview 中启用 firebase,而不是在本地环境中启用。无赖。【参考方案3】:

这个问题应该在 nuxt 2.5.1 版本中得到修复。

https://github.com/nuxt/nuxt.js/releases/tag/v2.5.1

【讨论】:

现在出现更多依赖错误:* core-js/modules/es6.array.find in ./.nuxt/client.js, ./node_modules/babel-loader/lib??ref- -2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/home/index.vue?vue&type=script&lang=js& 和其他 1 个 @ChrisF。删除节点模块并锁定文件并重新安装

以上是关于Nuxt 2.5.0 + Firebase - 未找到依赖项的主要内容,如果未能解决你的问题,请参考以下文章

Nuxt JS 未定义 Firebase 存储 XMLHttpRequest 错误

带有 firebase nuxt 模块的 Firebase 存储在删除文件后无法读取未定义的属性“删除”

Nuxt this.$route 未定义

Nuxt ^2.0.0 和 Firebase 托管

在组合 api 中使用注入变量(nuxt.firebase)

如何使用 Nuxt.js 实现 Firebase 云消息传递 (FCM)