You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

部署Nuxt 3至Firebase遇未知错误,寻求技术协助

Nuxt3部署Firebase时出现TypeError问题求助

我的配置

firebase.json内容

{
  "functions": [
    {
      "source": ".output/server",
      "runtime": "nodejs16"
    }
  ],
  "hosting": {
    "public": ".output/public",
    "cleanUrls": true,
    "rewrites": [
      {
        "source": "**",
        "function": "server"
      }
    ],
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

nuxt.config.ts修改内容

export default defineNuxtConfig({
  nitro: {
    preset: 'firebase'
  },
.....
})

package.json部署脚本

"deploy-fb": "cd .output/server && rm -rf node_modules && npm i && cd .. && firebase deploy",

错误详情

执行部署脚本后触发错误,firebase-debug.log中的错误日志如下:

[debug] [2024-03-06T17:37:51.732Z] Building nodejs source
[info] i  functions: Loading and analyzing source code for codebase default to determine what to deploy 
[debug] [2024-03-06T17:37:51.734Z] Could not find functions.yaml. Must use http discovery
[debug] [2024-03-06T17:37:51.743Z] Found firebase-functions binary at '/Users/julapps/web/gundu-web/.output/server/node_modules/.bin/firebase-functions'
[info] Serving at port 8566

[debug] [2024-03-06T17:37:53.072Z] Got response from /__/functions.yaml {"endpoints":{"server":{"platform":"gcfv1","availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"serviceAccountEmail":null,"vpc":null,"region":[null],"httpsTrigger":{},"entryPoint":"server"}},"specVersion":"v1alpha1","requiredAPIs":[]}
[debug] [2024-03-06T17:37:58.266Z] TypeError: Cannot read properties of null (reading 'match')
    at resolveString (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/params.js:31:27)
    at /Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/params.js:47:36
    at Array.map (<anonymous>)
    at Object.resolveList (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/params.js:47:21)
    at toBackend (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/build.js:181:30)
    at Object.resolveBackend (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/build.js:74:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async prepare (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/functions/prepare.js:69:62)
    at async chain (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/index.js:38:9)
    at async deploy (/Users/julapps/web/gundu-web/node_modules/firebase-tools/lib/deploy/index.js:95:5)
[error] 
[error] Error: An unexpected error has occurred.

恳请技术人员帮忙解决该问题。

内容的提问来源于stack exchange,提问作者Nanda Z

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 09:13:27