daveneeley / asdf-powershell-core

Powershell core install from tarball
Other
1 stars 1 forks source link

An error ocurred while installing powershell-core 7.3.1 #1

Open johnjelinek opened 1 year ago

johnjelinek commented 1 year ago

When I try to install latest on an m1 mac running Ventura 13.1, it fails to install.

asdf install powershell-core latest

* Downloading powershell-core release 7.3.1...
chmod: /Users/jojeli/.asdf/installs/powershell-core/7.3.1/pwsh: No such file or directory
asdf-powershell-core: Expected /Users/jojeli/.asdf/installs/powershell-core/7.3.1/pwsh to be executable.
asdf-powershell-core: An error ocurred while installing powershell-core 7.3.1.

I tracked it down to the extract process: https://github.com/daveneeley/asdf-powershell-core/blob/0ce7dad54bb09612a8b789f88bcfb8e161547e1d/bin/download#L20

if you drop --strip-components=1 then, it is able to install.

asdf install powershell-core latest
mkdir: /Users/jojeli/.asdf/downloads/powershell-core/7.3.1: File exists
* Downloading powershell-core release 7.3.1...
powershell-core 7.3.1 installation was successful!

Now, when I run pwsh, macos pops up with a lot of messages to allow *.dylib files. After I allow all those, now I get this error:

pwsh

Unhandled exception. System.BadImageFormatException: Could not load file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies cannot be loaded for execution. (0x80131058)
File name: 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.BadImageFormatException: Cannot load a reference assembly for execution.
[1]    31603 abort      pwsh

file $(asdf where powershell-core)/pwsh

~/.asdf/installs/powershell-core/7.3.1/pwsh: Mach-O 64-bit executable arm64
johnjelinek commented 1 year ago

I ended up fixing this after the "installation was successful" by replacing the entire 7.3.1 directory:

rm -rf $(asdf where powershell-core)
mkdir -p $(asdf where powershell-core)
tar -xzf ~/Downloads/powershell-7.3.1-osx-arm64.tar.gz -C $(asdf where powershell-core)
chmod +x $(asdf where powershell-core)/pwsh

I still had to hit Allow Anyway for each of the dylib files, but after that, pwsh came up.

daveneeley commented 1 year ago

I noticed that earlier this week on WSL and it seems like something changed in the artifact paths inside the github release. Thanks for the report. I'll update when it's fixed.

daveneeley commented 1 year ago

This should be resolved now. Update your plugin to the latest with asdf plugin update powershell-core then run a new plugin install.