[英]Cannot find module 'firebase-admin' when trying to deploy Firebase functions
I have deployed the three functions successfully for a couple of month, and now it suddenly started trippin' on me. 我已经成功地部署了这三个功能几个月,现在它突然开始对我发起攻击。 I haven't changed the node, npm or firebase cli versions for a while. 我有一段时间没有更改节点,npm或firebase cli版本。 I upgraded the npm packages within the functions directory as a desperation to fix this, but no luck. 我在函数目录中升级了npm包作为绝望来解决这个问题,但没有运气。 Why is this happening? 为什么会这样? Repo (hoverboard-v2 branch): https://github.com/gdgfresno/valleydevfest2017/tree/hoverboard-v2/functions 回购(hoverboard-v2分支): https : //github.com/gdgfresno/valleydevfest2017/tree/hoverboard-v2/functions
Ubuntu 17.04, console deployment Ubuntu 17.04,控制台部署
npm --version
5.5.1
node --version
v8.1.0
firebase --version
3.13.1
Here is the error: 这是错误:
Deployment failure: 部署失败:
Function load error: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'firebase-admin'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/user_code/node_modules/firebase-functions/lib/apps.js:25:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
package.json: 的package.json:
{
"name": "hoverboard-functions",
"description": "Hoverboard serverless functions",
"dependencies": {
"firebase-admin": "^5.4.2",
"firebase-functions": "^0.6.2",
"moment": "^2.19.1"
},
"private": true
}
index.js: index.js:
'use strict';
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.sendGeneralNotification = require('./notifications');
exports.scheduleNotifications = require('./schedule-notifications');
exports.saveUserData = require('./users');
Same issue here. 同样的问题在这里 It is a firebase problem. 这是一个火力问题。
There is disruption in firebase cloud service since yesterday. 自昨天以来,firebase云服务中断。
problem description: https://status.firebase.google.com/incident/Functions/17024 问题描述: https : //status.firebase.google.com/incident/Functions/17024
problem solution: 问题方案:
Run the following commands inside the functions repository: 在函数库中运行以下命令:
npm install --save-exact firebase-functions@0.7.0 npm install --save-exact firebase-admin@5.4.0
Then try deploying functions again: 然后再尝试部署函数:
firebase deploy --only functions
I hope this helps :) 我希望这有帮助 :)
I have sorted it out using previous versions: 我已使用以前的版本对其进行了整理:
npm install --save-exact firebase-functions@0.6.3 npm install --save-exact firebase-functions@0.6.3
npm install --save-exact firebase-admin@5.2.1 npm install --save-exact firebase-admin@5.2.1
At least until it would be resolved 至少在它解决之前
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.