0

I have been trying to install flyctl on my Windows 10 system with the command mentioned on the website:

curl -L https://fly.io/install.sh | sh

when I run the above command, I get the following error message:

sh : The term 'sh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:37
+ curl -L https://fly.io/install.sh | sh
+                                     ~~
    + CategoryInfo          : ObjectNotFound: (sh:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I was trying to Install flyctl From fly.io Website

mklement0
  • 382,024
  • 64
  • 607
  • 775
  • 1
    sh is the Bourne shell on Unix so obviously it won't be available on Windows unless you're using some POSIX environment on Windows like wsl, wsl2, cygwin or msys and even if you have, the above install.sh script is tailored for Linux and might not work at all on Windows. Did you even read the [installation documentation on fly.io](https://fly.io/docs/hands-on/install-flyctl/)? – phuclv May 27 '23 at 12:13

1 Answers1

2

As @phuclv mentioned in the comment, you need to run the task specified for your OS (operating system).

For Windows, the installation process is:

pwsh -Command "iwr https://fly.io/install.ps1 -useb | iex"

The link to the docs: https://fly.io/docs/hands-on/install-flyctl/#windows

mklement0
  • 382,024
  • 64
  • 607
  • 775
Victor Silva
  • 723
  • 4
  • 17
  • 1
    I didn't recognize `iex`; it's an alias for [`Invoke-Expression`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-7.3). – Jonathan Dodds May 27 '23 at 14:12
  • Exactly! It's an alias. You can check running: Get-Alias -Name iex – Victor Silva May 28 '23 at 14:53
  • 1
    Minor point but production PowerShell code should not use aliases - see [Don't use aliases in scripts](https://learn.microsoft.com/en-us/powershell/scripting/learn/shell/using-aliases?view=powershell-7.3#dont-use-aliases-in-scripts). The fly install script should not use `iex`. – Jonathan Dodds May 28 '23 at 21:58