【问题标题】:Unable to build NextJS app locally when using Firestore使用 Firestore 时无法在本地构建 NextJS 应用程序
【发布时间】:2021-05-26 19:41:51
【问题描述】:

我正在构建一个 Web 应用,并使用 getStaticPropsgetStaticPaths 从客户端和服务器上的 Firestore 获取数据。

几个月来一切正常,因为我在 Vercel 上部署我的应用时只运行了 next build

我现在正在尝试在本地构建我的应用,但出现以下错误

@firebase/firestore: Firestore (8.6.2): INTERNAL UNHANDLED ERROR:  Error: ENOENT: no such file or directory, open '/Users/.../.next/serverless/protos/google/firestore/v1/firestore.proto'
    at Object.openSync (fs.js:462:3)
    at Object.readFileSync (fs.js:364:35)
    at fetch (/Users/.../.next/serverless/chunks/254.js:70692:34)
    at Root.load (/Users/.../.next/serverless/chunks/254.js:70726:13)
    at Root.loadSync (/Users/.../.next/serverless/chunks/254.js:70767:17)
    at Object.loadSync (/Users/.../.next/serverless/chunks/254.js:43330:29)
    at loadProtos (/Users/.../.next/serverless/chunks/254.js:16365:41)
    at newConnection (/Users/.../.next/serverless/chunks/254.js:16386:18)
    at OnlineComponentProvider.exports.modules.6631.OnlineComponentProvider.createDatastore (/Users/.../.next/serverless/chunks/254.js:21071:26)

我很困惑,所以非常感谢任何帮助。

非常感谢!

【问题讨论】:

    标签: firebase google-cloud-firestore next.js


    【解决方案1】:

    逐行删除代码后,它最终成为next.config.js 文件中的旧设置。

    删除此问题解决了问题

    module.exports = {
      ...
      target: 'serverless'
    };
    

    【讨论】:

      猜你喜欢
      • 2022-10-17
      • 2021-06-25
      • 2018-01-16
      • 2020-04-07
      • 1970-01-01
      • 1970-01-01
      • 2019-07-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多