How do I fix 'executable not found on PATH' errors?
If, during deployment or continuous development, you are getting errors in the
form of executable file not found in $PATH
.
For example:
time="2018-11-01T12:46:38-04:00" level=fatal msg="exiting dev mode because the first build failed: building [gcr.io//my-proj]: tagging: pushing: getting auth config for gcr.io//my-proj:3c275201-dirty-50f870d: getting auth config: error getting credentials - err: exec: "docker-credential-gcr": executable file not found in $PATH, out: ``"
Then, you may be running into the problem where the IDE is not inheriting the
shell environment variables. This can happen in some Linux environments when
the PATH
variables are defined in .bash_profile
or .bash_rc
and the
IDE is launched from the GUI, causing the IDE not to see the PATH
variables.
This can be solved by allowing Cloud Code to automatically manage updates to Cloud SDK and Kubernetes dependencies, using the Cloud Code settings within your IDE (File > Settings > Other Settings > Cloud Code > Kubernetes or for Mac OS X, IntelliJ IDEA > Preferences > Other Settings > Cloud Code > Kubernetes).
If you'd like to maintain custom versions of these dependencies, you can solve this issue in Linux using the following workaround:
Launch the IDE from the terminal
First, follow these instructions to enable a command-line launcher. Then launch the IDE from the terminal.
For example, to launch IntelliJ IDEA from the terminal, navigate to the project you wish to open, then execute:
idea .
Similarly, to launch PyCharm, execute:
charm .
Alternatively, set the
PATH
variables in a system-wide location such as /etc/environment.