vegardit / scoop-portable

Self-contained Windows batch file that installs/loads a portable scoop (https://scoop.sh) environment.
Apache License 2.0
3 stars 1 forks source link

`scoop install` broken? #6

Open nitincodery opened 1 month ago

nitincodery commented 1 month ago

First Run:

scoop install fd
Installing 'fd' (10.1.0) [64bit] from 'main' bucket
fd-v10.1.0-x86_64-pc-windows-msvc.zip (1.2 MB) [======================] 100%
Checking hash of fd-v10.1.0-x86_64-pc-windows-msvc.zip ... ok.
Extracting fd-v10.1.0-x86_64-pc-windows-msvc.zip ... done.
Linking D:\scoop-portable\apps\fd\current => D:\scoop-portable\apps\fd\10.1.0
New-Item: D:\scoop-portable\apps\scoop\current\lib\install.ps1:1174
Line |
1174 |          New-Item -Path $source -ItemType Junction -Value $target
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Incorrect function.
Creating shim for 'fd'.
Get-Command: D:\scoop-portable\apps\scoop\current\lib\install.ps1:783
Line |
 783 |              $bin = (Get-Command $target).Source
     |                      ~~~~~~~~~~~~~~~~~~~
     | The term 'fd.exe' 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.
Can't shim 'fd.exe': File doesn't exist.

Second Run:

scoop install fd
WARN  Purging previous failed installation of fd.
ERROR 'fd' isn't installed correctly.
Removing older version (10.1.0).
'fd' was uninstalled.
Installing 'fd' (10.1.0) [64bit] from 'main' bucket
Loading fd-v10.1.0-x86_64-pc-windows-msvc.zip from cache
Checking hash of fd-v10.1.0-x86_64-pc-windows-msvc.zip ... ok.
Extracting fd-v10.1.0-x86_64-pc-windows-msvc.zip ... done.
Linking D:\scoop-portable\apps\fd\current => D:\scoop-portable\apps\fd\10.1.0
New-Item: D:\scoop-portable\apps\scoop\current\lib\install.ps1:1174
Line |
1174 |          New-Item -Path $source -ItemType Junction -Value $target
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Incorrect function.
Creating shim for 'fd'.
Adding D:\scoop-portable\shims to your path.
Copy-Item: D:\scoop-portable\apps\scoop\current\lib\manifest.ps1:82
Line |
  82 |          Copy-Item (manifest_path $app $bucket) "$dir\manifest.json"
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find drive. A drive with the name 'File not found - D' does not exist.
MethodInvocationException: D:\scoop-portable\apps\scoop\current\lib\manifest.ps1:95
Line |
  95 |      [System.IO.File]::WriteAllLines("$dir\install.json", $file_conten …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "WriteAllLines" with "2" argument(s): "The filename, directory name, or volume label syntax is incorrect. :
     | 'D:\scoop-portable\File not found - D:\scoop-portable\apps\fd\current D:\scoop-portable\apps\fd\current\install.json'"
'fd' (10.1.0) was installed successfully!

After second run, fd works, but what are these errors?

Also, I already have scoop installed in my system, I had to remove the scoop shims from path, why not we can temporarily delete scoop shims from path and install scoop-portable, then again add back system scoop shims to the path, instead of saying scoop is already present in path.

nitincodery commented 1 month ago

Happens for another app too, but this time it installs after single run, maybe because the only change is now that I have added my system scoop shims back to path variable, before when I had removed the scoop shims path from path variable, after second run too, fd wasn't installing, and now when system's scoop path is added back, things are installing but with these errors.

> scoop install sd
Installing 'sd' (1.0.0) [64bit] from 'main' bucket
sd-v1.0.0-x86_64-pc-windows-msvc.zip (884.8 KB) [===========================================================================] 100%
Checking hash of sd-v1.0.0-x86_64-pc-windows-msvc.zip ... ok.
Extracting sd-v1.0.0-x86_64-pc-windows-msvc.zip ... done.
Linking D:\scoop-portable\apps\sd\current => D:\scoop-portable\apps\sd\1.0.0
New-Item: D:\scoop-portable\apps\scoop\current\lib\install.ps1:1174
Line |
1174 |          New-Item -Path $source -ItemType Junction -Value $target
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Incorrect function.
Creating shim for 'sd'.
Copy-Item: D:\scoop-portable\apps\scoop\current\lib\manifest.ps1:82
Line |
  82 |          Copy-Item (manifest_path $app $bucket) "$dir\manifest.json"
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find drive. A drive with the name 'File not found - D' does not exist.
MethodInvocationException: D:\scoop-portable\apps\scoop\current\lib\manifest.ps1:95
Line |
  95 |      [System.IO.File]::WriteAllLines("$dir\install.json", $file_conten …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "WriteAllLines" with "2" argument(s): "The filename, directory name, or volume label syntax is incorrect. :
     | 'D:\scoop-portable\File not found - D:\scoop-portable\apps\sd\current D:\scoop-portable\apps\sd\current\install.json'"
'sd' (1.0.0) was installed successfully!

> where sd
D:\scoop-portable\shims\sd.exe
C:\Users\nitin\scoop\shims\sd.exe
nitincodery commented 1 month ago

When I removed system's scoop from path variable, it is not installing at all and keeps giving this same error:

> scoop install sed
WARN  Purging previous failed installation of sed.
ERROR 'sed' isn't installed correctly.
Removing older version (4.9).
'sed' was uninstalled.
Installing 'sed' (4.9) [64bit] from 'main' bucket
Loading sed-4.9-x64.exe from cache
Checking hash of sed-4.9-x64.exe ... ok.
Linking D:\scoop-portable\apps\sed\current => D:\scoop-portable\apps\sed\4.9
New-Item: D:\scoop-portable\apps\scoop\current\lib\install.ps1:1174
Line |
1174 |          New-Item -Path $source -ItemType Junction -Value $target
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Incorrect function.
Creating shim for 'sed'.
Get-Command: D:\scoop-portable\apps\scoop\current\lib\install.ps1:783
Line |
 783 |              $bin = (Get-Command $target).Source
     |                      ~~~~~~~~~~~~~~~~~~~
     | The term 'sed.exe' 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.
Can't shim 'sed.exe': File doesn't exist.
nitincodery commented 1 month ago

After second run, fd works, but what are these errors?

This was because, I added system's scoop back to path, but without it, it keeps failing like above.

nitincodery commented 1 month ago

Also, does scoop-portable fixes its path in the path environment variable when the drive letter changes in case of external drives?

sebthom commented 1 month ago

The idea of scoop-portable is not to rely on persisted environment variables but when you run scoop-portable.cmd the env vars are setup ad-hoc for the current command window. when you move the installation to another directory or drive scoop-portable will detect it and adjust all the internal symlinks accordingly.

nitincodery commented 4 weeks ago

What about install errors? How to fix them?

sebthom commented 4 weeks ago

TBH, no idea, I cannot reproduce it.