Reputation: 11
Every time I run 'firebase deploy' I get this error message:
Error: Failed to load function definition from source: Failed to generate manifest from function source: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/ghaith/Desktop/FacilityManagement/fm_back/functions/node_modules/firebase/package.json
I've tried reinstalling npm modules, I updated everything as well!
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);
Upvotes: 1
Views: 1375
Reputation: 11
I think the problem with Firebase Cli v11.0!
Can you check the version and try to use Firebase Cli v10.8 for now.
It has some breaking changes with ext:dev:emulators:start
and ext:dev:emulators:exec
preview commands. Hence creating that problem.
Upvotes: 1