简体   繁体   English

尝试部署Firebase功能时找不到模块“firebase-admin”

[英]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云服务中断。

see this image 看到这个图像

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.

相关问题 Firebase-functions 部署错误“错误:EACCES:权限被拒绝,打开&#39;/root/.config/configstore/firebase-tools.json&#39;” - Firebase-functions deploy error "Error: EACCES: permission denied, open '/root/.config/configstore/firebase-tools.json'" Firebase服务失败但部署工作正常 - Firebase serve fails but deploy works fine 错误:找不到模块&#39;hbsfy&#39; - Error: Cannot find module 'hbsfy' Python找不到mongoengine模块 - Python cannot find mongoengine module Heroku 无法自动检测到用于此应用程序的 buildpack。 尝试将文件部署/推送到 heroku 时出错 - 有什么修复吗? - Heroku cannot detect the buildpack to use for this application automatically. error when trying to deploy/push files to heroku - any fixes? 无法找到 mySQL -- 尝试从命令行访问 mySQL 时出现“未找到命令”错误 - Cannot find mySQL -- get "command not found" error when trying to access mySQL from command line 错误:在结构 1.2 中找不到模块“cors” - Error : Cannot find Module 'cors' in fabric 1.2 node.js:找不到模块“请求” - node.js: cannot find module 'request' npm 错误! 找不到模块“编码” - npm ERR! Cannot find module 'encoding' 咕unt声:错误:找不到模块“ ./util/task” - Grunt: Error: Cannot find module './util/task'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM