Closed mklement0 closed 10 months ago
$HOME/.local/share/powershell/Modules
is where it should be installing. See: https://github.com/PowerShell/PSResourceGet/blob/edd5ff4a0b2ef1ef294fe46d488e2a1ff8a50145/src/code/Utils.cs#L994
v1.0.0 is installing to that directory for me.
Can you try running Install-PSResource -Scope CurrentUser -Debug -Verbose
and sharing the output?
On macOS (13.5.2), the value of [Environment]::GetFolderPath('LocalApplicationData')
is (abstract form used; in PowerShell terms, it is "$HOME/Library/Application Support"
):
~/Library/Application Support
and that is also what I see when I run your command:
VERBOSE: All paths to search: '/Users/jdoe/Library/Application Support/powershell/Modules'
VERBOSE: All paths to search: '/Users/jdoe/Library/Application Support/powershell/Scripts'
VERBOSE: Retrieving directories in the path '/Users/jdoe/Library/Application Support/powershell/Modules'
VERBOSE: Retrieving directories in the path '/Users/jdoe/Library/Application Support/powershell/Scripts'
DEBUG: In GetHelper::GetPackagesFromPath()
DEBUG: In GetHelper::FilterPkgPathsByName()
DEBUG: In GetHelper::FilterPkgPathsByVersion()
DEBUG: In InstallPSResource::ProcessInstallHelper()
DEBUG: In InstallHelper::BeginInstallPackages()
DEBUG: Parameters passed in >>> Name: 'classexplorer'; VersionRange: ''; NuGetVersion: ''; VersionType: 'NoVersion'; Version: ''; Prerelease: 'False'; Repository: ''; AcceptLicense: 'False'; Quiet: 'False'; Reinstall: 'False'; TrustRepository: 'False'; NoClobber: 'False'; AsNupkg: 'False'; IncludeXml 'True'; SavePackage 'False'; TemporaryPath ''; SkipDependencyCheck: 'False'; AuthenticodeCheck: 'False'; PathsToInstallPkg: '/Users/jdoe/Library/Application Support/powershell/Modules,/Users/jdoe/Library/Application Support/powershell/Scripts'; Scope 'CurrentUser'
DEBUG: In InstallHelper::ProcessRepositories()
VERBOSE: Attempting to search for packages in 'PSGallery'
DEBUG: In InstallHelper::InstallPackages()
DEBUG: In InstallHelper::InstallPackage()
DEBUG: In V2ServerAPICalls::FindName()
DEBUG: In V2ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='classexplorer'&$inlinecount=allpages&$filter=IsLatestVersion and Id eq 'classexplorer''
I wonder if .NET made a change here, but the problem is that the path is not in $PSModulePath so the module isn't found
Bingo, @SteveL-MSFT: GetFolderPath behavior on Unix: "Starting in .NET 8, the behavior of Environment.GetFolderPath on Unix operating systems has changed."
@SteveL-MSFT is PowerShell going to continue to use $HOME/.local/share/powershell/Modules
or migrate to $HOME/Library/Application Support/powershell/Modules
?
Prerequisites
Steps to reproduce
On macOS,
Install-PSResource -Scope CurrentUser
(the default scope) targets"$HOME/Library/Application Support/powershell/Modules"
, which isn't in listed in$env:PSModulePath
.Therefore, user-scoped modules are simply unavailable (not discoverable) after installation.
Note that PowerShellGet 2.x targets
"$HOME/.local/share/powershell/Modules"
, which is in$env:PSModulePath
Expected behavior
Either target
"$HOME/.local/share/powershell/Modules"
, as before, or update PowerShell to to also include"$HOME/Library/Application Support/powershell/Modules"
in$env:PSModulePath
by default, so that user-scope-installed modules become available as expected.Actual behavior
User-scope-installed modules aren't discoverable.
Error details
No response
Environment data
Visuals
No response