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

Firebase CLI执行firebase init storage报错‘Cloud resource location is not set’,已设位置仍无效

解决Firebase Storage初始化时“Cloud resource location未设置”的问题

问题场景

在新Angular项目中执行firebase init storage时,明明已在Firebase控制台设置云资源位置(europe-west3),却仍触发以下错误:

Error: Cloud resource location is not set for this project but the operation you are attempting to perform in Cloud Storage requires it.

已尝试操作:创建新的Firebase/Angular项目、手动设置资源位置、更换目录重新初始化、重装Firebase CLI,但问题未解决。

可行解决方法

  • 等待控制台设置同步:控制台设置资源位置后,后端服务可能需要5-10分钟完成同步,不要立刻执行初始化命令,间隔一段时间再尝试。
  • 通过CLI手动设置资源位置:
    1. 先查看项目支持的位置列表:firebase projects:locations:list
    2. 手动指定目标位置:firebase projects:locations:set europe-west3
      注意:执行此命令需要你拥有项目所有者或足够权限,设置完成后重新执行firebase init storage。
  • 初始化时直接指定位置:
    运行firebase init storage后,当CLI提示选择Cloud Storage位置时,直接选中europe-west3,强制指定位置完成初始化,不依赖控制台的预设。
  • 重新关联项目登录状态:
    执行firebase logout退出当前登录,再用firebase login重新登录,确保CLI关联的是已设置资源位置的目标Firebase项目,避免账号切换导致的信息不一致。
  • 手动创建存储桶后再初始化:
    先到Firebase控制台的Storage模块,手动创建存储桶并指定europe-west3位置,之后执行firebase init storage,选择“使用已有的存储桶”选项,跳过位置设置步骤。

内容的提问来源于stack exchange,提问作者Christopher von der Hardt

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.13 08:27:06