Installed Google Cloud SDK but can't access gcloud

后端 未结 3 1333
有刺的猬
有刺的猬 2021-02-04 05:57

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 whe

3条回答
  •  时光取名叫无心
    2021-02-04 06:36

    Looking at the output of the install tool:

    Enter path to an rc file to update, or leave blank to use [/Users/nico/.bash_profile]:
    

    ... it appears that the install tool updated "/Users/nico/.bash_profile" whereas Mac OS X relies on "/Users/nico/.profile" for the configuration. Copy the changes to "/Users/nico/.bash_profile" over to "/Users/nico/.profile" and then close and restart the Terminal for the changes to take effect.

    In the new shell, you can see if "gcloud" is defined using the command:

     which gcloud
    

    It should output:

     /Users/nico/google-cloud-sdk/bin/gcloud
    

    If that doesn't work, then I'd recommend just updating your PATH manually. To do that, edit ~/.profile:

     nano ~/.profile
    

    And then add the following line at the very end:

     export PATH="$HOME/google-cloud-sdk/bin:$PATH"
    

    And restart your shell. Note that if you are using a shell other than the builtin Terminal, you may need to edit a different file (such as ~/.bashrc or ~/.bash_profile for a custom BASH installation, and various other "rc" files for altnerative shells such as ZSH, CSH, etc.) to update your PATH variable.

    If this is still not working, I'd suggest debugging by typing:

    echo "$PATH"
    

    ... so that you can at least see what the current path is set to.

提交回复
热议问题