Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to install on Powershell: path not recognized #950

Open
lomirus opened this issue Dec 13, 2023 · 6 comments
Open

Failed to install on Powershell: path not recognized #950

lomirus opened this issue Dec 13, 2023 · 6 comments

Comments

@lomirus
Copy link

lomirus commented Dec 13, 2023

Output:

> Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; try { Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $true } catch { Write-Error $_ }
Welcome to Haskell!

This script can download and install the following programs:
  * ghcup - The Haskell toolchain installer
  * ghc   - The Glasgow Haskell Compiler
  * msys2 - A linux-style toolchain environment required for many operations
  * cabal - The Cabal build tool for managing Haskell software
  * stack - (optional) A cross-platform program for developing Haskell projects
  * hls   - (optional) A language server for developers to integrate with their editor/IDE

Please note that ANTIVIRUS may interfere with the installation. If you experience problems, consider
disabling it temporarily.

Where to install to (this should be a short Path, preferably a Drive like 'C:\')?
If you accept this path, binaries will be installed into 'C:\Program Files\ghcup\bin' and msys2 into 'C:\Program Files\ghcup\msys64'.
Press enter to accept the default [C:\Program Files\]:


Setting env variable GHCUP_INSTALL_BASE_PREFIX to 'C:\Program Files\'
Preparing for GHCup installation...
Specify Cabal directory (this is where haskell packages end up)
Press enter to accept the default [C:\Program Files\\cabal]:


Install HLS
Do you want to install the haskell-language-server (HLS) for development purposes as well?
[Y] Yes  [N] No  [A] Abort  [?] Help (default is "N"): y

Install stack
Do you want to install stack as well?
[Y] Yes  [N] No  [A] Abort  [?] Help (default is "N"): y

Create Desktop shortcuts
Do you want to create convenience desktop shortcuts (e.g. for uninstallation and msys2 shell)?
[Y] Yes  [N] No  [A] Abort  [?] Help (default is "Y"): y
First checking for Msys2...

Install MSys2
Do you want GHCup to install a default MSys2 toolchain (recommended)?
[Y] Yes  [N] No  [?] Help (default is "Y"): y
...Msys2 doesn't exist, installing into C:\Program Files\\ghcup\msys64
Starting installation in 5 seconds, this may take a while...
Downloading Msys2 archive 20221216...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 57.0M  100 57.0M    0     0  7058k      0  0:00:08  0:00:08 --:--:-- 7295k
Extracting Msys2 archive...


System ERROR:
当文件已存在时,无法创建该文件。
Processing MSYS2 bash for first time use...
Write-Error: The term 'C:\Program Files\\ghcup\msys64\usr\bin\bash' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

The first error message in Chinese under "System ERROR",

当文件已存在时,无法创建该文件。

means

Cannot create the file when this file has already existed.
@hasufell
Copy link
Member

What are the contents of C:\Program Files\ghcup recursively?

@lomirus
Copy link
Author

lomirus commented Dec 14, 2023

The directory C:\Program Files\ghcup does not exist.

QQ截图20231214150104

@hasufell
Copy link
Member

Do you have write permissions there?

@lomirus
Copy link
Author

lomirus commented Dec 14, 2023

No...because the GHCup download page says "run the following in a PowerShell session (as a non-admin user)", so I just ran the installation command as a non-admin user in powershell.

image

@hasufell
Copy link
Member

Yes, but you need to specify a location where you have write access

@lomirus
Copy link
Author

lomirus commented Dec 15, 2023

Thanks, I've installed ghcup successfully by installing as an admin user. But I think maybe the error message could be improved, because it does not say anything about the permission and thus makes it difficult to find the cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants