reactjs Firebase部署:TypeError [ERR_INVALID_ARG_TYPE]:“path”参数必须是字符串类型,接收未定义

xoshrz7s  于 2023-05-17  发布在  React
关注(0)|答案(1)|浏览(346)

使用Firebase,我想部署我的nextjs项目进行托管。
在使用NextJS的优化时,我遇到了这个错误。
有人知道怎么修吗?
这是命令行的输出:

=== Deploying to 'web1'...

i  deploying functions, database, storage, hosting
i  functions: preparing codebase firebase-frameworks-web1-142ec for deployment
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: Loaded environment variables from .env.
i  functions: preparing .firebase/web1-142ec/functions directory for uploading...
i  functions: packaged /blog/.firebase/web1-142ec/functions (70.68 MB) for uploading
i  functions: ensuring required API run.googleapis.com is enabled...
i  functions: ensuring required API eventarc.googleapis.com is enabled...
i  functions: ensuring required API pubsub.googleapis.com is enabled...
i  functions: ensuring required API storage.googleapis.com is enabled...
✔  functions: required API eventarc.googleapis.com is enabled
✔  functions: required API run.googleapis.com is enabled
✔  functions: required API storage.googleapis.com is enabled
✔  functions: required API pubsub.googleapis.com is enabled
i  functions: generating the service identity for pubsub.googleapis.com...
i  functions: generating the service identity for eventarc.googleapis.com...

Error: An unexpected error has occurred.

这将创建一个包含以下错误的新日志文件:

[debug] [2023-05-12T13:26:53.454Z] TypeError [ERR_INVALID_ARG_TYPE]: 
    The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:399:5)
    at validateString (node:internal/validators:163:11)
    at Object.join (node:path:1172:7)
    at Config.path (/lib/node_modules/firebase-tools/lib/config.js:123:45)
    at RulesDeploy.addFile (/lib/node_modules/firebase-tools/lib/rulesDeploy.js:37:46)
    at default_1 (/lib/node_modules/firebase-tools/lib/deploy/storage/prepare.js:39:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async chain (/lib/node_modules/firebase-tools/lib/deploy/index.js:38:9)
    at async deploy (/lib/node_modules/firebase-tools/lib/deploy/index.js:95:5)
[error] Error: An unexpected error has occurred.
cgfeq70w

cgfeq70w1#

可能是CloudFunctions设置不正确。删除firebase.json并运行

firebase init

在我的例子中,它创建了缺少的配置文件。

相关问题