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

初始化Firebase Cloud Storage模拟器遇云资源位置配置错误

Firebase存储模拟器本地启动问题

我正在使用Firebase模拟器进行本地开发并测试Cloud Functions,其中一个场景涉及向Cloud Storage上传文件,操作流程及遇到的问题如下:

初始化Firebase模拟器

执行命令:

npx firebase init emulators

交互流程:

=== Emulators Setup
? Which Firebase emulators do you want to set up? Press Space to select emulators, then Enter to confirm your choices. Storage 
Emulator
? Which port do you want to use for the storage emulator? 9199
? Would you like to enable the Emulator UI? Yes
? Which port do you want to use for the Emulator UI (leave empty to use any available port)? 
? Would you like to download the emulators now? Yes

启动存储模拟器时出错

尝试启动仅包含存储服务的Firebase模拟器:

npx firebase emulators:start --only storage

收到错误提示:

Error: Cannot start the Storage emulator without rules file specified in firebase.json: run 'firebase init' and set up your Storage configuration

初始化存储服务时再次出错

由于启动Cloud Storage模拟器需要先创建storage.rules文件,我执行以下命令:

npx firebase init storage

收到错误提示:

=== Storage Setup
Error: Cloud resource location is not set for this project but the operation you are attempting to perform in Cloud Storage requires it. 请查看相关官方文档了解详情

问题补充

我已在Firebase控制台启用存储服务,并选择了与其他Firebase服务一致的资源位置,但数小时后仍收到相同错误,本地Firebase环境未识别到存储服务已激活。

环境信息

•   macOS Sequoia 15.0
•   VS Code 1.95.1
•   Node.js v18(也尝试过v20和v22)
•   Firebase CLI 13.23.1

内容的提问来源于stack exchange,提问作者Fabio Moggi

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 14:52:13