comando gcloud no encontrado - durante la instalación de Google Cloud SDK


Estoy en un mac y estoy tratando de instalar el SDK de Google Cloud (incluida la utilidad de línea de comandos gcloud) usando este comando en terminal

curl https://sdk.cloud.google.com | bash

Como se ve en https://cloud.google.com/sdk/

Llegó hasta el final y terminó, pero incluso después de reiniciar mi shell, el comando gcloud todavía dice que no se encuentra.

¿Por qué no funciona esta instalación?

Author: smntx, 2015-06-25

18 answers

Así que a continuación está mi corrección anterior para este problema, pero resulta que no es permanente. Funciona, pero cada vez que reinicies Terminal, tendrías que hacer lo mismo, lo cual no es práctico.

Así que es por eso que sugiero que elimine el directorio actual de google-cloud-sdk, y simplemente rehaga la instalación. Asegúrese (como Zachary ha mencionado) de responder sí (Y) al prompt Modify profile to update your $PATH and enable bash completion? (Y/n).

Aquí está mi vieja respuesta, pero simplemente rehaga la instalación:

I had the same problem, `gcloud` wasn't working for me.
But then, in the same directory as my `google-cloud-sdk` folder which I had just installed (my `home` directory), I found this file called `test`.
Inside this `test` file I found two commands:


    # The next line updates PATH for the Google Cloud SDK.
    source '[path-to-my-home]/google-cloud-sdk/path.bash.inc'
    # The next line enables bash completion for gcloud.
    source '[path-to-my-home]/google-cloud-sdk/completion.bash.inc'

After I ran these two `source` commands in terminal, `gcloud` worked!
 72
Author: smntx,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-06-25 19:16:31

Lo mismo aquí, intento

source ~/.bashrc

Entonces, funcionó

 28
Author: nvcken,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-09-09 09:01:32

En Mac / Linux, deberá ingresar la siguiente entrada en su ~/.bashrc:

export PATH="/usr/lib/google-cloud-sdk/bin:$PATH"
 18
Author: Cawfree,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-09-09 19:46:14

Este funcionó para mí:

source ~/.bash_profile
 16
Author: mirza vu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-16 17:29:50

Tuve este problema hoy, y añadiendo sudo a la install command solucionado mi problema en maxOS Sierra!

sudo ./google-cloud-sdk/install.sh
 11
Author: Ibrahim,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-01 23:20:53

Sé que esta pregunta ha sido respondida, pero aquí están mis dos centavos. Después de instalar gcloud, debe reiniciar el shell antes de poder ejecutar el comando gcloud.

Cómo hacer esto, depende principalmente del archivo que mantenga su configuración de shell. La mayoría de los archivos son .bashrc_profile, .bashrc, .zshrc.

Ahora puede reiniciar con

source ~/.bashrc_profile

Puede reemplazar el archivo por el archivo que tiene.

O si no le importa el archivo que tiene, en Mac o Linux puede reiniciar el shell .

exec -l $SHELL

 10
Author: Kanyi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-15 12:08:59

Al instalar el SDK usé este método:

curl https://sdk.cloud.google.com | bash

Al usar este método del autor original, asegúrese de haber aceptado las preferencias de seguridad en la configuración de Mac para permitir que las aplicaciones descargadas de la tienda de aplicaciones y los desarrolladores identificados.

 5
Author: IOT internet of things,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-18 22:45:43

Tuve que buscar el código fuente de mi archivo bash_profile. Para ello,

  1. Abre una sesión de Terminal.
  2. En ese tipo de sesión: fuente .bash_profile y luego presione enter

Ahora, el comando gcloud debería funcionar

 4
Author: MG Denver,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-09-05 18:17:10

Esto funcionó para mí :

Después de decir Y a Modify profile to update your $PATH and enable bash completion? (Y/n)?

Google initiation está solicitando esto : Enter a path to an rc file to update, or leave blank to use y la ruta predeterminada era : [/Users/MY_USERSAME/.bash_profile]: pero en lugar de presionar enter, escribí : /Users/MY_USERNAME/.bashrc para cambiar la ruta.

Esto sobrescribiría la ubicación predeterminada que Google sugiere.

Entonces, solo tenía que hacer source ~/.bashrc y todo funciona ahora!

 4
Author: Thierry,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-28 16:35:32

Estoy ejecutando zsh y encontré esto muy útil: https://gist.github.com/dwchiang/10849350

Edita el ~/.zshrc archivo para incluir estas dos líneas:

# The next line updates PATH for the Google Cloud SDK.
source /Users/YOUR_USERNAME/google-cloud-sdk/path.zsh.inc

# The next line enables zsh completion for gcloud.
source /Users/YOUR_USERNAME/google-cloud-sdk/completion.zsh.inc

Esto supone que ha instalado el paquete en su directorio principal desde los documentos oficiales

 4
Author: Connor Leech,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-04 23:44:22

Solo tienes que ejecutar este comando como root

$ curl https://sdk.cloud.google.com | bash

Reinicie el terminal y listo. Ahora todos los comandos deben ser ejecutados como root

 3
Author: Jhon Salazar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-09 17:12:47

Encontré if-fi declaraciones incorrectas en mi ~/.bash_profile (no condición if en el siguiente bloque)

source '/Users/yorko/google-cloud-sdk/path.bash.inc'

fi

Solo tuve que eliminar "fi" y ejecutar "source ~/.bash_profile" para que funcionara.

 2
Author: Kashnitsky,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-02 18:36:57

Si se ejecuta

source ~/.bashrc

Resulta en"No hay tal archivo o directorio"

En windows:

  1. Vaya a c/Users/
  2. Mientras mantiene presionada la tecla mayús, haga clic con el botón derecho .bashrc y seleccione "Copiar como ruta"
  3. En bash: source <pasteCopiedPathHere> - > por ejemplo: source "C:\Users\John\.bashhrc"
 2
Author: Sebastian,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-04 15:12:44

Tuve el mismo problema y fue porque el ~/.bash_profile tenía sentencias fi inválidas.

La solución:

  1. Ejecutar comando sudo nano ~/.bash_profile
  2. Eliminadas las declaraciones de cierre fi (las que faltan una apertura if)
  3. Guardar .bash_profile changes
  4. Ejecutar comando source ~/.bash_profile
 0
Author: John Doherty,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-05 17:50:30
$ sudo su
$ /opt/google-appengine-sdk/bin/gcloud components update
$ su <yourusername>
 0
Author: Tiago Ferreira,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-08 14:53:59

Las instrucciones posteriores a la instalación no son claras:

==> Source [/.../google-cloud-sdk/completion.bash.inc] in your profile to enable shell command completion for gcloud.
==> Source [/.../google-cloud-sdk/path.bash.inc] in your profile to add the Google Cloud SDK command line tools to your $PATH.

Tuve que agregar las siguientes líneas de código en mi .bash_profile para que gcloud funcionara:

source '/.../google-cloud-sdk/completion.bash.inc'
source '/.../google-cloud-sdk/path.bash.inc'
 0
Author: denyit,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-01 14:21:14

Ahora después de ejecutar install.sh en Mac OS, Google mismo da la información para ejecutar completion.bash.inc y path.bash.inc.

Si está utilizando zsh terminal, le pedirá que ejecute completion.zsh.inc y path.zsh.inc. Por favor, vea la imagen de abajo

introduzca la descripción de la imagen aquí

 0
Author: arthankamal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-07 00:37:38

Cómo instalar GCloud y Siempre Funciona después del Reinicio En Mac OS HIGH Sierra:

  1. Descargar paquete de instalación Aquí

  2. Logrado archivo y soltar en su carpeta

  3. Abra terminal, vaya a su carpeta con archivo e ingrese este comando: . /google-cloud-sdk/install.sh
  4. " ¿Modificar el perfil para actualizar su PATH PATH y habilitar la finalización de bash?" Sí
  5. Introduzca esta ruta para modificar: "/Users / USERNAME_COMPUTER/.bashrc "
  6. Después de todo instalar, introduzca esto: "fuente ~/.bashrc "
  7. Introduzca esto para comprobar instalar gcloud: "gcloud - -version"
  8. Abra una nueva ventana terminal 'cmd+n' NO CIERRE LA VENTANA ANTIGUA e ingrese en la nueva ventana'gcloud version' si: "comando no encontrado", vaya al paso 9 de lo contrario: Felicitaciones GCloud trabajo en terminal
  9. Vuelva a la ventana anterior e introduzca 'echo PATH PATH' y copiar ruta a GCloud
  10. Abrir BASH_PROFILE: abrir ~/.bash_profile
  11. Introduzca la ruta a la nueva Bash: " exportación PATH= "/ Users/USERNAME_COMPUTER/google-cloud-sdk / bin: PATH PATH" "
  12. Volver al paso 8
 0
Author: Maxim Vakurin,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-21 07:04:35