简体   繁体   English

尝试安装 Google Cloud SDK 时出现格式错误的输入错误

[英]Malformed entry error while trying to install Google Cloud SDK

When I execute the below command in Ubuntu当我在 Ubuntu 中执行以下命令时

sudo apt-get update & sudo apt-get install Google-cloud-SDK

I am getting the below error.我收到以下错误。

E: Malformed entry 1 in list file /etc/apt/sources.list.d/google-cloud-sdk.list (Component)
E: The list of sources could not be read.

删除/etc/apt/sources.list.d/google-cloud-sdk.list并重新尝试 gcloud 安装步骤解决了我的问题。

sudo rm /etc/apt/sources.list.d/google-cloud-sdk.list

I ran into this same error when trying to follow the Install the latest Cloud Tools version for Ubuntu .我在尝试遵循为 Ubuntu 安装最新的云工具版本时遇到了同样的错误。 My problem was that I assumed Google wanted me to add this command to my .bashrc instead of just running it in my terminal.我的问题是我认为 Google 希望我将此命令添加到我的.bashrc而不是仅仅在我的终端中运行它。

export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"

This means running the next step:这意味着运行下一步:

echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

Will result in a /etc/apt/sources.list.d/google-cloud-sdk.list that reads as (note the double space):将导致/etc/apt/sources.list.d/google-cloud-sdk.list读作(注意双空格):

deb http://packages.cloud.google.com/apt  main

To fix this, just restart your terminal or run source ~/.bashrc .要解决此问题,只需重新启动终端或运行source ~/.bashrc

Use your favorite text editor and fix the entry in /etc/apt/sources.list.d/google-cloud-sdk.list :使用您喜欢的文本编辑器并修复/etc/apt/sources.list.d/google-cloud-sdk.list的条目:

deb http://packages.cloud.google.com/apt  main

The missing part is between that "apt" and "main".缺少的部分在“apt”和“main”之间。 It should be one of the values from Google's distro list .它应该是 Google发行版列表中的值之一。 Normally, this can be generated by running echo cloud-sdk-$(lsb_release -c -s) .通常,这可以通过运行echo cloud-sdk-$(lsb_release -c -s)

A possible valid entry might look like this:一个可能的有效条目可能如下所示:

deb http://packages.cloud.google.com/apt cloud-sdk-zesty main

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM