在 MacOS 上运行 gsutil

Jør*_*sen 0 google-cloud-storage firebase gsutil firebase-storage

我正在尝试使用 gsutil 根据谷歌的说明使用最新版本的 MacOS 在我的 firebase 存储桶上设置 CORS。我不确定我是否没有正确安装 gsutil 或者是否还有其他我不明白的东西,但是当我运行时gsutil cors set cors.json gs://docavea2.appspot.com出现以下错误:

Setting CORS on gs://docavea2.appspot.com/...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/jr/google-cloud-sdk/platform/gsutil/gslib/__init__.py", line 119, in <module>
    CHECKSUM_FILE, CHECKSUM = _GetFileContents('CHECKSUM')
  File "/Users/jr/google-cloud-sdk/platform/gsutil/gslib/__init__.py", line 107, in _GetFileContents
    content = pkgutil.get_data('gslib', filename)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 591, in get_data
    return loader.get_data(resource_name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 255, in get_data
    return open(pathname, "rb").read()
IOError: [Errno 2] No such file or directory: '/Users/jr/google-cloud-sdk/platform/gsutil/gslib/CHECKSUM'
Run Code Online (Sandbox Code Playgroud)

我认为我的 cors.json 很好,因为当我在 Windows 上将它与 gsutil 一起使用时,它工作正常并且 CORS 设置正确,但这是内容:

[
    {
        "origin": ["*"],
        "method": ["GET"],
        "maxAgeSeconds": 3600
    }
]
Run Code Online (Sandbox Code Playgroud)

我在 stackoverflow 上看到有人说如果他把 [{ 放在同一行对他有用,但对我来说没有区别。

Jør*_*sen 6

我发现 CHECKSUM 安装在 /Users/jr/google-cloud-sdk/platform/gsutil 中。

在我将其复制到 /Users/jr/google-cloud-sdk/platform/gsutil/gslib/ 后,它就可以工作了。