firebase deploy --only 函数上出现 NPM 错误的原因是啥
Posted
技术标签:
【中文标题】firebase deploy --only 函数上出现 NPM 错误的原因是啥【英文标题】:What's the reason for NPM Error on firebase deploy --only functionsfirebase deploy --only 函数上出现 NPM 错误的原因是什么 【发布时间】:2019-02-07 04:11:14 【问题描述】:我最近在尝试部署 Firebase 功能时遇到此错误。但是,自上次成功部署以来,我没有更改任何依赖项...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (57.25 KB) for uploading
✔ functions: functions folder uploaded successfully
i functions: updating Node.js 6 function firestoreEmail(us-central1)...
i functions: updating Node.js 6 function apiMain(us-central1)...
✔ functions[apiMain(us-central1)]: Successful update operation.
⚠ functions[firestoreEmail(us-central1)]: Deployment error.
Build failed: exit status 1
npm ERR! Linux 4.4.0-133-generic
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "--global-style" "--production" "--fetch-retries=5" "--fetch-retry-factor=2" "--fetch-retry-mintimeout=1000" "install" "/workspace"
npm ERR! node v6.14.0
npm ERR! npm v3.10.10
npm ERR! Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net"
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /workspace/npm-debug.log
Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
【问题讨论】:
运行 $ npm install -g firebase-tools 时出现同样的错误 在尝试部署我的功能时遇到了同样的错误。谢谢分享 【参考方案1】:Firebase 状态页面提到 NPM 注册表中断
https://status.firebase.google.com/incident/Functions/18033
【讨论】:
【参考方案2】:出现了中断https://status.npmjs.org/incidents/v22ffls5cd6h - 他们建议更改您的 DNS,因为 ISP 正在缓存错误的详细信息。
【讨论】:
【参考方案3】:运行这条线(我知道它很丑,但它有效):
dig www.npmjs.com @1.1.1.1 | tac | echo "$(grep -oP 'www\.npmjs\.com(.)+\t\K([\d\.]*)' -m 1) www.npmjs.com"
将输出复制并粘贴到/etc/hosts
文件的末尾
【讨论】:
以上是关于firebase deploy --only 函数上出现 NPM 错误的原因是啥的主要内容,如果未能解决你的问题,请参考以下文章
运行 firebase Deploy -Flutter -Firebase 时在错误的路径中生成 Functions 文件夹
Firebase Github Deploy无法解析travis.yml
相同的 Flutter Web 构建使用 `dhttp` 在本地运行,但使用 `firebase serve` 或 `firebase deploy` 失败
Firebase serve --only functions VS local emulator 在本地运行云功能?
为啥 export const helloWorld 在 firebase deploy 中出现错误而 export.helloWorld 没有?