0

您好世界和平同胞和 Moonbase-36 居民,部署此 firebase 功能失败,因为我已将 EASYPOST 添加到文件中。我是否需要创建另一个函数文件并部署它以使其工作?

// require('babel-polyfill');
const functions = require("firebase-functions");
const cors = require("cors");
const express = require("express");
const EasyPost = require('@easypost/api');
const EPapi = new EasyPost('YOURAPIKEY');

const app = express();
const stripe = require("stripe")("APIKEY");

一旦我注释掉 const EasyPost 和 const EPapi,部署就可以正常工作。但我们需要 Easypost 才能工作。

firebase 函数:日志详细的堆栈跟踪:错误:找不到模块'@easypost/api'

4

1 回答 1

1

OP 通过将 Easypost 安装npm install Easypost到 Functions 文件夹中以将其作为 firebase 函数的依赖项解决了该问题。功能部署没有错误。

于 2022-02-20T08:57:22.103 回答