upleveled / system-setup

Set up a PERN development environment on Windows, macOS and Linux
28 stars 19 forks source link

bash: flyctl: command not found #102

Closed karlhorky closed 2 weeks ago

karlhorky commented 2 weeks ago

On Windows, some students are experiencing issues locating the Chocolatey installation of flyctl:

$ flyctl deploy
bash: flyctl: command not found

With this PATH:

$ echo $PATH
/c/Users/efron/AppData/Local/Android/Sdk/platform-tools:/c/Users/efron/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/efron/bin:/c/Python312/Scripts:/c/Python312:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/ProgramData/chocolatey/bin:/cmd:/c/Program Files/nodejs:/c/Program Files/Microsoft VS Code/bin:/c/Program Files/PostgreSQL/16/bin:/c/Program Files/Docker/Docker/resources/bin:/c/Users/efron/AppData/Local/pnpm:/c/Users/efron/AppData/Local/Microsoft/WindowsApps:/c/Users/efron/AppData/Local/Programs/Microsoft VS Code/bin:/c/Users/efron/AppData/Roaming/npm:/c/Users/efron/.fly:/c/Users/efron/AppData/Local/Programs/Hyper/resources/bin:/c/Users/efron/AppData/Local/GitHubDesktop/bin:/usr/bin/vendor_perl:/usr/bin/core_perl:/c/Program Files/PostgreSQL/16/bin:/c/Program Files/PostgreSQL/16/bin:/c/Program Files/PostgreSQL/16/bin:/c/Program Files/PostgreSQL/16/bin:/c/Program Files/PostgreSQL/16/bin

In other cases, a different error message appeared, more like this:

bash: /c/Users/Admin/.fly/flyctl: No such file or directory

Maybe something is wrong with the PATH

It appears that using the path with bin resolves it for some students, eg:

echo 'export PATH="$PATH:$HOME/.fly/bin"' >> ~/.bashrc

So maybe it's missing the /bin part in the PATH

karlhorky commented 2 weeks ago

The PATH example above has this potentially incorrect part:

:/c/Users/efron/.fly:

Maybe it's supposed to be /c/Users/efron/.fly/bin

The student ran choco install flyctl again, and it appeared to add the location without the bin again:

$ choco install flyctl
Extracting C:\Users\efron\AppData\Local\Temp\chocolatey\flyctl\0.3.23\flyctl_0.3.23_Windows_x86_64.zip to C:\Users\efron\.fly...
C:\Users\efron\.fly
PATH environment variable does not have C:\Users\efron\.fly in it. Adding...
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 The install of flyctl was successful.
  Deployed to 'C:\Users\efron\.fly'
karlhorky commented 2 weeks ago

However, the same student now reported that running flyctl again after reinstalling worked out of the box, with no problems finding the binary.

$ flyctl status
App
  Name     = cattos-store
  Owner    = personal
  Hostname = cattos-store.fly.dev
  Image    = cattos-store:deployment-01JADHTQH6QMZRZHN2YKN09Q33  

Machines
PROCESS ID              VERSION REGION  STATE   ROLE    CHECKS  LAST UPDATED
app     d8d9299a120908  3       otp     stopped                 2024-10-17T15:36:14Z

So for now, closing this, as new Chocolatey installations of flyctl should not have this problem.

If we encounter this issue again in future, we can reopen and investigate further.