我已經在幾個月內成功部署了這三個功能,現在它突然開始對我進行踐踏。我還沒有改變節點,npm或firebase cli版本一段時間。我升級了函數目錄中的npm包作爲絕望來解決這個問題,但沒有運氣。這是爲什麼發生?回購(懸浮滑板-V2分支):https://github.com/gdgfresno/valleydevfest2017/tree/hoverboard-v2/functions嘗試部署Firebase功能時找不到模塊'firebase-admin'
的Ubuntu 17.04,控制檯部署
npm --version
5.5.1
node --version
v8.1.0
firebase --version
3.13.1
以下是錯誤:
部署失敗:
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:
{
"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:
'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');
哇。今晚我會試試這個 –
現在Firebase解決了這個問題。 –