ScoopInstaller / Install

📥 Next-generation Scoop (un)installer
https://get.scoop.sh
The Unlicense
742 stars 94 forks source link

Show single quotes in instructions while passing path arguments #79

Closed goyalyashpal closed 6 months ago

goyalyashpal commented 6 months ago

Description

fatal: could not create leading directories of '$env:DUF\scoop\apps\scoop\current': Invalid argument
...
New-Item : Cannot find drive. A drive with the name '$env' does not exist.
At ...\scoop_install.ps1:605 char:13
+             New-Item -Type Directory $SCOOP_APP_DIR | Out-Null

Installation Logs

installation logs ```console > $VerbosePreference='Continue' > .\scoop_install.ps1 -ScoopDir '$env:DUF\scoop' -ScoopGlobalDir '$env:DPF\scoop_global' VERBOSE: -------- PSBoundParameters -------- VERBOSE: [ScoopDir, $env:DUF\scoop] VERBOSE: [ScoopGlobalDir, $env:DPF\scoop_global] VERBOSE: -------- Environment Variables -------- VERBOSE: $env:USERPROFILE: C:\Users\... VERBOSE: $env:ProgramData: C:\ProgramData VERBOSE: $env:SCOOP: VERBOSE: $env:SCOOP_CACHE: VERBOSE: $env:SCOOP_GLOBAL: VERBOSE: -------- Selected Variables -------- VERBOSE: SCOOP_DIR: $env:DUF\scoop VERBOSE: SCOOP_CACHE_DIR: $env:DUF\scoop\cache VERBOSE: SCOOP_GLOBAL_DIR: $env:DPF\scoop_global VERBOSE: SCOOP_CONFIG_HOME: C:\Users\...\.config Initializing... Downloading... VERBOSE: Cloning https://github.com/ScoopInstaller/Scoop.git to $env:DUF\scoop\apps\scoop\current fatal: could not create leading directories of '$env:DUF\scoop\apps\scoop\current': Invalid argument WARNING: Cloning failed. Falling back to downloading zip files. New-Item : Cannot find drive. A drive with the name '$env' does not exist. At ...\scoop_install.ps1:605 char:13 + New-Item -Type Directory $SCOOP_APP_DIR | Out-Null + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: ($env:String) [New-Item], DriveNotFoundException + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.NewItemCommand ```
##### PowerShell Context
powershell context ```console > $PSVersionTable Name Value ---- ----- PSVersion 5.1.19041.4046 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.4046 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 ```
#### Additional Information #### Possible Solution Use double-quotes in readme, unless there's specific reason to use single-quotes https://github.com/ScoopInstaller/Install/blob/f212421eb2fa5f937cd1bcfa3495910283cee81c/README.md?plain=1#L43-L54
goyalyashpal commented 6 months ago

image

using double quotes also makes the variables to be correctly parsed/highlighted :)

successful logs ```console > .\scoop_install.ps1 -ScoopDir "$env:DUF\scoop" -ScoopGlobalDir "$env:DPF\scoop_global" VERBOSE: -------- PSBoundParameters -------- VERBOSE: [ScoopDir, D:\UserFiles\scoop] VERBOSE: [ScoopGlobalDir, D:\ProgramFiles\scoop_global] VERBOSE: -------- Environment Variables -------- VERBOSE: $env:USERPROFILE: C:\Users\... VERBOSE: $env:ProgramData: C:\ProgramData VERBOSE: $env:SCOOP: VERBOSE: $env:SCOOP_CACHE: VERBOSE: $env:SCOOP_GLOBAL: VERBOSE: -------- Selected Variables -------- VERBOSE: SCOOP_DIR: D:\UserFiles\scoop VERBOSE: SCOOP_CACHE_DIR: D:\UserFiles\scoop\cache VERBOSE: SCOOP_GLOBAL_DIR: D:\ProgramFiles\scoop_global VERBOSE: SCOOP_CONFIG_HOME: C:\Users\...\.config Initializing... Downloading... VERBOSE: Cloning https://github.com/ScoopInstaller/Scoop.git to D:\UserFiles\scoop\apps\scoop\current VERBOSE: Cloning https://github.com/ScoopInstaller/Main.git to D:\UserFiles\scoop\buckets\main Creating shim... Adding D:\UserFiles\scoop\shims to your path. VERBOSE: Adding config root_path: D:\UserFiles\scoop VERBOSE: Adding config global_path: D:\ProgramFiles\scoop_global Scoop was installed successfully! Type 'scoop help' for instructions. ```
goyalyashpal commented 6 months ago

also, i just noticed that it doesn't create any directory at the -ScoopGlobalDir option. is that expected?

the reason that's special is 'cz that directory required admin permissions, and i don't know how to give those permissions at CLI.

chawyehsu commented 6 months ago

No directory will be created when performing the installation of Scoop, the value of the -ScoopGlobalDir option you specified will be written to the config file of Scoop (located in <YOUR HOME DIR>\.config\scoop\config.json by default) and it will be used when you install apps globally, the directory will be created at that time.

i don't know how to give those permissions at CLI.

Either start up a powershell session with Run as Administrator or install the gsudo app from the main bucket and type sudo scoop ...