我正在尝试在OSX上安装Google Cloud SDK并完成这个Node.js教程 (https://cloud.google.com/nodejs/getting-started/hello-world),但是总是遇到一个问题,即找不到gcloud
命令。可能只是关于设置或保存文件位置的简单问题。
我已经阅读了许多其他帖子,但无法解决这个问题。以下是所有步骤/问题:
我已经在开发控制台中创建了一个项目。
安装Cloud SDK
MacBook-Pro-2:~ nico$ curl https://sdk.cloud.google.com | bash
然后按照流程进行
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]:
然后我尝试进行身份验证:
MacBook-Pro-2:~ nico$ gcloud auth login
-bash: gcloud: command not found
然后我进入了云sdk二进制文件目录
MacBook-Pro-2:~ nico$ cd google-cloud-sdk/bin
MacBook-Pro-2:bin nico$ ./gcloud auth login
验证成功
MacBook-Pro-2:bin nico$ ./gcloud config set project helloworld-project
项目设置成功。
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.
那么我就移出了那个目录
MacBook-Pro-2:test_project nico$ gcloud components update app
-bash: gcloud: command not found
现在它不起作用了,我需要设置gcloud以使其可以全局访问吗?如何更新并访问gcloud命令行工具?
which gcloud
,但没有显示任何内容,然后我打开了nano ~/.profile
并添加了它(截图:http://www.screencast.com/t/bEssG5te4n),然后按下^O。我重新启动了终端,但仍然没有运行。我还编辑了`~/.bash_profile`并在那里添加了它(截图:http://www.screencast.com/t/jkpNucYZ),但仍然不起作用。有什么想法吗? - NicoMMacBook-Pro-2:~ nico$ cat ~/.profile
,它返回export PATH="$HOME/google-cloud-sdk/bin:$PATH"
。 - NicoM