GHC for Haskell not installing

Viewed 470

When I tried to install Haskell through Chocolatey, I find that GHC is not getting installed along with a package of Chocolatey. I tried to re-install Haskell by force. Then also, GHC is not getting installed. I get the following error message:

 Access to the path 'C:\tools\ghc-9.2.1-x86_64-unknown-mingw32' is denied.
Renamed C:\tools\ghc-9.2.1-x86_64-unknown-mingw32 to C:\tools\ghc-9.2.1
ERROR: Could not find a part of the path 'C:\tools\ghc-9.2.1\bin\ghcii.sh'.
The install of ghc was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\ghc\tools\chocolateyInstall.ps1'.
 See log for details.
.
.
.
Failures
 - ghc (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\ghc\tools\chocolateyInstall.ps1'.
 See log for details.

I installed Haskell using Chocolatey successfully twice by watching this YouTube video.. Though I followed the same procedure today as well, GHC cannot be installed. My online research to fix this problem didn't work as well. What should I do to fix this?

Best regards,

1 Answers

1:17 of the video.
Right-click on PowerShell -> Run as Administrator (then confirm the Elevated mode).

choco install haskell-dev

Chocolatey v0.10.15

Chocolatey detected you are not running from an elevated command shell (cmd/powershell). You may experience errors - many functions/packages require admin rights. Only advanced users should run choco w/out an elevated shell. When you open the command shell, you should ensure that you do so with "Run as Administrator" selected. If you are attempting to use Chocolatey in a non-administrator setting, you must select a different location other than the default install location. See https://chocolatey.org/install#non-administrative-install for details.

Chocolatey installation without Admin Rights

If this isn't the case, try to uninstall everything, restart and install again with current versions.

Related