每次我运行'firebase deploy'我得到这个错误消息:
错误:Failed to load function definition from source: Failed to generate manifest from function source: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports"main定义在/Users/ghaith/Desktop/FacilityManagement/fm_back/functions/node_modules/firebase/package.json
我试过重新安装npm模块,我也更新了所有的东西!
const functions = require("firebase-functions");
const admin = require("firebase-admin");
const app = require("express")();
admin.initializeApp();
const config = {...};
const firebase = require("firebase");
firebase.initializeApp(config);
app.get("/requests", (req, res) => {
admin
.firestore()
.collection("requests")
.orderBy("createdAt", "desc")
.get()
.then((data) => {
let requests = [];
data.forEach((doc) => {
requests.push({
requestID: doc.id,
fname: doc.data().fname,
email: doc.data().email,
desc: doc.data().desc,
issue: doc.data().issue,
address: doc.data().address,
});
});
return res.json(requests);
})
.catch((err) => console.error(err));
});
exports.api = functions.https.onRequest(app);
我认为Firebase Cli v11.0的问题!
你现在可以检查一下版本并尝试使用Firebase Cli v10.8吗
与ext:dev:emulators:start
和ext:dev:emulators:exec
预览命令有一些突破性的变化。因此产生了那个问题。