安装了Google Cloud SDK,但无法访问gcloud [英] Installed Google Cloud SDK but can't access gcloud
问题描述
我正尝试在OSX上安装Google Cloud SDK,并执行此node.js教程( https://cloud.google.com/nodejs/getting-started/hello-world ),并继续遇到问题,其中 gcloud
是未找到。这可能只是简单的设置在哪里或在哪里保存文件。
我在这里阅读了大量其他帖子,但无法解决这个问题。以下是所有步骤/问题:
我已经在开发台中创建了一个项目。
安装云sdk
MacBook-Pro-2:〜 nico $ curl https://sdk.cloud.google.com | bash
然后浏览过程
目录解压缩(这将创建一个目录google-cloud-sdk)(/ Users / nico):
你想帮助改进Google Cloud SDK (Y / N)? y
修改配置文件以更新$ PATH并启用bash完成? (Y / N)? y
输入要更新的rc文件的路径,或留空以使用[/Users/nico/.bash_profile]:
然后我试图验证:
MacBook-Pro-2:〜nico $ gcloud auth login
-bash:gcloud:command not found
然后我进了一个云sdk bin目录
MacBook-Pro-2:〜nico $ cd google-cloud-sdk / bin
MacBook -Pro-2:bin nico $ ./gcloud auth login
验证成功
MacBook-Pro-2:bin nico $ ./gcloud配置项目helloworld-project
pre>
设计项目成功
MacBook-Pro-2 :bin nico $ ./gcloud组件更新应用程序
错误:(gcloud.components.update)您当前的工作目录位于Cloud SDK安装根目录中:/ Users / nico / google-cloud-sdk。
为了执行此更新,请从此目录外部运行命令。
所以我搬出该目录
MacBook-Pro-2:test_project nico $ gcloud组件更新应用程序
-bash:gcloud:命令未找到
现在它不工作,我必须将gcloud设置在某个地方,以便全局访问?如何更新它并访问gcloud命令行工具?
解决方案在我的〜/ .bash_profile菜单中我有一个错误,在顶部我有这条线:
如果哪个rbenv>的/ dev / null的;然后eval$(rbenv init - ); fi source /Users/nico/.bash_profile
哪个是扔了一个错误,搞乱了$ $ $ c> gcloud ,奇怪的是其他命令行变量可以正常工作。
一旦我删除了这行
gcloud
工作正常。I am trying to install the Google Cloud SDK on OSX and do this node.js tutorial (https://cloud.google.com/nodejs/getting-started/hello-world) and keep running into a problem where the
gcloud
is not found. It might be just be something simple about setting in or where I'm in saving the file.I've read a ton of other posts here but haven't been able to solve this problem. Here are all the steps/issues:
I already created a project in the dev console.
Install the cloud sdk
MacBook-Pro-2:~ nico$ curl https://sdk.cloud.google.com | bash
Then go through the process
Directory to extract under (this will create a directory google-cloud-sdk) (/Users/nico): Do you want to help improve the Google Cloud SDK (Y/n)? y Modify profile to update your $PATH and enable bash completion? (Y/n)? y Enter path to an rc file to update, or leave blank to use [/Users/nico/.bash_profile]:
Then I tried to authenticate:
MacBook-Pro-2:~ nico$ gcloud auth login -bash: gcloud: command not found
Then I went into a cloud sdk bin directory
MacBook-Pro-2:~ nico$ cd google-cloud-sdk/bin MacBook-Pro-2:bin nico$ ./gcloud auth login
Authentication was successful
MacBook-Pro-2:bin nico$ ./gcloud config set project helloworld-project
Setting the project was successful
MacBook-Pro-2:bin nico$ ./gcloud components update app ERROR: (gcloud.components.update) Your current working directory is inside the Cloud SDK install root: /Users/nico/google-cloud-sdk. In order to perform this update, run the command from outside of this directory.
So then I move out of that directory
MacBook-Pro-2:test_project nico$ gcloud components update app -bash: gcloud: command not found
And now it's not working, do I have to set gcloud somewhere so it can be access globally? How can I update it and access the gcloud command line tool?
解决方案In my ~/.bash_profile menu I had an error, at the top I had this line:
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi source /Users/nico/.bash_profile
Which was throwing an error and messed with
gcloud
, the weird thing is that other command line variables worked fine with that error.Once I removed that line
gcloud
worked fine.这篇关于安装了Google Cloud SDK,但无法访问gcloud的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!