Firebase-tools: 错误:发生意外错误。 •TypeError:无法读取未定义的“需要”属性

创建于 2019-07-04  ·  25评论  ·  资料来源: firebase/firebase-tools

不要删除validate_template = true template_path = .github / ISSUE_TEMPLATE / bug_report.md感谢您为Firebase社区做出的贡献! md5-353ec455af687f8506bc657fb00d641b是的,我们绝对不完美! 请使用此模板,并在打开问题时提供最少的复制。 如果您知道如何解决问题,请创建一个请求请求,我们很乐意对其进行审核! md5-5a586e3327dd4d66403b6b4e17827083很好,我们喜欢听到我们如何改进我们的产品! 但是,请勿使用此模板提交功能请求。 请将您的功能请求提交至:https://firebase.google.com/support/contact/bugs-features/ md5-01dd92482184ab052bb298afd6f855e1我们有很多这样的产品,我们很乐意为您提供帮助,但是GitHub并不是他们的最佳选择将被关闭。 请首先查看该指南:https://firebase.google.com/docs/cli/如果官方文档没有帮助,请尝试通过我们的官方支持渠道进行询问:https://firebase.google.com/支持/检查社区解决方案或帮助的其他位置:-堆栈溢出:https://stackoverflow.com/-Firebase Slack社区:https://firebase.community/ *请避免跨多个渠道重复发布!*您正在使用的Firebase CLI版本(“ firebase-tools”)? 请注意,您的问题可能已经在最新版本中得到解决。 最新版本可以在https://github.com/firebase/firebase-tools/releases找到


firebase-tools:7.0.2


平台:macOS


将网站部署到Firebase托管已停止工作。


Firebase部署-仅托管


托管成功。


托管失败。

[2019-07-04T15:46:39.915Z] -------------------------------------- --------------------------------
[2019-07-04T15:46:39.918Z]命令:/Users/Azlan_Mac/.nvm/versions/node/v12.3.1/bin/node /Users/Azlan_Mac/.nvm/versions/node/v12.3.1/bin / firebase deploy-仅托管--debug
[2019-07-04T15:46:39.918Z] CLI版本:7.0.2
[2019-07-04T15:46:39.918Z]平台:达尔文
[2019-07-04T15:46:39.918Z]节点版本:v12.3.1
[2019-07-04T15:46:39.919Z]时间:2019年7月4日星期四23:46:39 GMT + 0800(马来西亚时间)
[2019-07-04T15:46:39.919Z] -------------------------------------- --------------------------------

[2019-07-04T15:46:39.928Z]>命令需要范围:[“电子邮件”,“ openid”,“ https://www.googleapis.com/auth/cloudplatformprojects.readonly”,“ https:// www .googleapis.com / auth / firebase“,” https://www.googleapis.com/auth/cloud-platform“]
[2019-07-04T15:46:39.928Z]>通过登录用户进行授权
[2019-07-04T15:46:39.929Z] [iam]检查项目mydaypwaapp是否具有权限[“ firebase.projects.get”,“ firebasehosting.sites.update”]
[2019-07-04T15:46:39.930Z] >>> HTTP请求发布https://cloudresourcemanager.googleapis.com/v1/projects/mydaypwaapp:testIamPermissions
权限= [firebase.projects.get,firebasehosting.sites.update]
[2019-07-04T15:46:41.155Z] <<< HTTP RESPONSE 200 content-type =应用程序/ json; charset = UTF-8,Variant = X-Origin,Referer,Origin,Accept-Encoding,date = Thu,2019年7月4日15:46:41 GMT,server = ESF,cache-control = private,x-xss-protection = 0,x-frame-options = SAMEORIGIN,x-content-type-options = nosniff,server-timing = gfet4t7; dur = 1100,alt-svc = quic =“:443”; ma = 2592000; v =“ 46,43,39”,accept-ranges = none,transfer-encoding = chunked
[2019-07-04T15:46:41.157Z] >>> HTTP请求获取https://firebase.googleapis.com/v1beta1/projects/mydaypwaapp

[2019-07-04T15:46:41.471Z] <<< HTTP RESPONSE 200 content-type =应用程序/ json; charset = UTF-8,Variant = X-Origin,Referer,Origin,Accept-Encoding,date = Thu,2019年7月4日15:46:41 GMT,server = ESF,cache-control = private,x-xss-protection = 0,x-frame-options = SAMEORIGIN,x-content-type-options = nosniff,alt-svc = quic =“:443”; ma = 2592000; v =“ 46,43,39”,accept-ranges = none,transfer-encoding = chunked
[2019-07-04T15:46:42.874Z] TypeError:无法读取未定义的属性“需要”
在/Users/Azlan_Mac/.nvm/versions/node/v12.3.1/lib/node_modules/firebase-tools/lib/checkFirebaseSDKVersion.js:37:51
在processTicksAndRejections(内部/进程/task_queues.js:89:5)

错误:发生意外错误。

最有用的评论

@prescottpure在获得

所有25条评论

此问题没有模板所需的所有信息。 您好像忘了填写某些部分。 请更新此问题以获取更多信息。

在尝试部署云功能时也会看到此问题。 我相信这是导致问题的根源

@prescottpure在获得

部署函数时,我也会遇到同样的情况:firebase deploy --only函数

firebase-tools:7.0.2

@ mazlano27起到了作用,感谢您的发布! @brunovig您应该尝试一下( npm i -g [email protected]

救生员@ mazlano27

@prescottprue也对我

感谢所有人确定有问题的线路并找到解决方法!

我希望这周能看看。 谢谢

b / 137017689

看来npm outdated firebase-functions --json=true的输出在这里称为6.9.2和6.10.0之间没有变化

6.9.2 vs 6.10.0 npm comparison

好吧,我想我很幸运: npm i -g [email protected]对我不起作用。

@ mazlano27起到了作用,感谢您的发布! @brunovig您应该尝试一下( npm i -g [email protected]

谢谢。 这也对我有用。 看起来npm 6.10版由于无法部署云功能而存在一些问题。

7.1.0已缓解了此问题。

升级到npm 6.10.1和firebase-tools 7.2.2后,在功能部署和托管部署中均会出现此错误。 到目前为止,没有回滚的运气。

回滚到npm 6.9.2,并且可以正常工作。 Firebase -V也是6.8.0

对我来说,解决方法是安装node / 10.1.6.3。 现在也使用Firebase 7.0.2。

我们可以重新打开它吗,我再次遇到问题:

firebase --version
7.4.0

node --version
v10.15.3

npm --version
6.11.3

yarn --version
1.15.2

错误:

npm ERR! Cannot read property '0' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     ...2019-10-04T15_25_42_651Z-debug.log
[2019-10-04T15:25:42.753Z] TypeError: Cannot read property 'wanted' of undefined
    at ~/.nvm/versions/node/v10.15.3/lib/node_modules/firebase-tools/lib/checkFirebaseSDKVersion.js:38:51

[edit]升级到节点10.16.3(或12)无效。

[编辑] ...更多问题:

npm install firebase-functions<strong i="13">@latest</strong> firebase-admin<strong i="14">@latest</strong> --save
npm ERR! Cannot read property '0' of undefined

@npomfret对不起,您遇到了麻烦。 首先,我在这里看到两个错误:一个关于属性'0'和一个关于'wanted' 。 这对我来说是可疑的,没有更多上下文,很难说哪个是适当的错误。

您的日志向我表明您正在使用npm运行firebase工具( npm ERR!字符串表明了这一点)。 您是否已将firebase-tools作为项目的依赖项进行安装,并且正在npm脚本中运行firebase

没有更多信息,很难说是怎么回事。 我无法复制您的问题,但是看起来Cannot read property '0' of undefined将是您要解决的第一件事。

我跑了:

npm install -g firebase-tools

如果那是你的意思?

我正在运行以重新部署我的网站的命令是:

firebase deploy --debug --only hosting

@npomfret您是直接运行firebase deploy还是使用npm run ___执行它? 如果是这种情况,该文件夹中安装的package.json文件中的firebase-tools版本就是正在运行的版本,这可能会引起问题。

但是,看起来property '0'也在阻止您,而且我之前从未见过该错误。 它可能来自部署的构建/解析步骤。 如果可以共享package.jsonfirebase.json ,则可以缩小范围。

我使用的命令完全如上所述: firebase deploy --debug --only hosting

在这种情况下,没有package.json,我只是在部署主机,因此实际上只有firebase.jsonpublic目录,其中包含静态内容。

...解决了。 存在一些Firebase函数。 我删除了它们,使托管部署成功。 啊。 我讨厌节点。

@bkendall感谢您的帮助

@ npomfret👍很高兴您知道了!

伙计们,这个问题仍在发生……仅在托管方面没有问题,但是,如果我将功能添加到Firebase项目中,则会收到如您在照片中看到的错误

因此,基本上,一个兼具功能和托管功能的firebase项目在运行时
firebase deploy --only hosting
我收到以下错误。

image

如果我删除了功能文件夹,它的工作原理就像是魅力。

我也有这个问题。 谢谢@bdairy。 删除功能文件夹也对我有用。

删除/fuctions后, firebase deployfirebase deploy --only hosting /fuctions

此页面是否有帮助?
0 / 5 - 0 等级