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

Install-Module errors on install of Azure and AzureRM modules - MacOsX #1874

Closed
JoshLuedeman opened this issue Aug 18, 2016 · 15 comments
Closed
Labels
Area-PowerShellGet specific to PowerShellGet module OS-macOS Resolution-External The issue is caused by external component(s).

Comments

@JoshLuedeman
Copy link

Steps to reproduce

Run command Install-Module Azure or Install-Module AzureRM

Expected behavior

Install PowerShell module for interacting with Azure using Azure and AzureRM commandlets

Actual behavior

Receive following error code

PackageManagement\Install-Package : Unable to find module providers (PowerShellGet).
At /usr/local/microsoft/powershell/6.0.0-alpha.9/Modules/PowerShellGet/PSModule.psm1:1706 char:21

  • ... $null = PackageManagement\Install-Package @PSBoundParameters
  •                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Except
      ion
    • FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Environment data

> $PSVersionTable

Name Value


PSVersion 6.0.0-alpha
PSEdition Core
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.9
CLRVersion
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

@JoshLuedeman JoshLuedeman changed the title Install-Module errors on install of Azure and AzureRM modules Install-Module errors on install of Azure and AzureRM modules - MacOsX Aug 18, 2016
@TravisEz13
Copy link
Member

TravisEz13 commented Aug 18, 2016

Can you try 'Register-PSRepository -Default', then retry the repro?
After that, I suspect you are going to hit this issue: #1693

@JoshLuedeman
Copy link
Author

JoshLuedeman commented Aug 18, 2016

Received the same error, and I have verified that the PSModule.psm1 file exists at this path.

PackageManagement\Register-PackageSource : Unable to find module providers (PowerShellGet).
At /usr/local/microsoft/powershell/6.0.0-alpha.9/Modules/PowerShellGet/PSModule.psm1:4107 char:17

  • ... $null = PackageManagement\Register-PackageSource @PSBoundParamete ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (Microsoft.Power...erPackageSource:RegisterPackageSource) [Register-PackageS
      ource], Exception
    • FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSource

@TravisEz13 TravisEz13 added Area-PowerShellGet specific to PowerShellGet module OS-macOS labels Aug 18, 2016
@kilasuit
Copy link
Collaborator

Although not quite you are also likely to hit the issue in #1773 as well as Install-Module is not currently working due to version type changes in these builds

@JoshLuedeman
Copy link
Author

I receive the same error when trying Register-PsRepository -Default

@bmanikm
Copy link
Contributor

bmanikm commented Aug 20, 2016

@JoshLuedeman Please use one of the following options to install the modules.

Option 1: Replace the PSModule.psm1 file under PowerShellGet module base with the updated file from master branch (https://github.com/PowerShell/PowerShell).

Install-Module error got resolved by adding a workaround in PowerShellGet module.
Please replace the PSModule.psm1 file under PowerShellGet module base with https://github.com/PowerShell/PowerShell/blob/master/src/Modules/Shared/PowerShellGet/PSModule.psm1.
For more details --> #1927

Option 2: Get the latest CI build

https://ci.appveyor.com/project/PowerShell/powershell/build/artifacts
    OR
https://travis-ci.org/PowerShell/PowerShell/builds/ 

Option 3: Use NuGet provider to install the required module to the target location.

Install-Package -Name $ModuleName -Source https://www.powershellgallery.com/api/v2/ -ProviderName NuGet -ExcludeVersion -Destination $YourTargetLocation

@detorn
Copy link

detorn commented Aug 20, 2016

@bmanikm seeing the same behavior, can confirm option 1 does not remediate.

@jimbrookski
Copy link

jimbrookski commented Aug 23, 2016

I managed to get the AzureRM module to install by ensuring that the .NET core was installed, and by making sure to run powershell with sudo.
I cannot get powershell to import the AzureRM module, though, which I think is related to the fact that AzureRM targets the full .NET and .NET Core doesn't yet work.
I get the following error:

Import-Module -Name AzureRM -Verbose
VERBOSE: Loading module from path '/usr/local/microsoft/powershell/6.0.0-alpha.9/Modules/AzureRM/2.0.1/AzureRM.psd1'.

Import-Module : The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
At line:1 char:1
+ Import-Module -Name AzureRM -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileLoadException
    + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

@alexandair
Copy link
Contributor

@jimbrookski There are new AzureRM modules refactored to work on CoreCLR. Try Option 3 (Install-Package) from @bmanikm response above and specify AzureRM.NetCore.Preview as the name of the module.

@StephenGilboy
Copy link

StephenGilboy commented Aug 29, 2016

I followed @alexandair's advice and it worked. A step by step though is that you'll need to do the following. (I also put the modules in my home directory, not sure if that is correct)

  1. Install-Package -Name AzureRM.NetCore.Preview -Source https://www.powershellgallery.com/api/v2/ -ProviderName NuGet -ExcludeVersion -Destination $home/powershell/modules
  2. Import-Module $home/powershell/modules/AzureRM.Profile.NetCore.Preview
  3. Import-Module $home/powershell/modules/AzureRM.Resources.NetCore.Preview
  4. Import-Module $home/powershell/modules/AzureRM.NetCore.Preview
  5. Login-AzureRmAccount

Note: When I ran the command Get-Module -ListAvailable AzureRM was not in the list and it seems that when you exit Powershell the AzureRM module goes away. Also, before I started I upgraded dotnet to version 1.0.0-preview3-003246

@dfr0
Copy link

dfr0 commented Sep 17, 2016

Great, works corretly but it's very important...we need use for example the following commands:

Get-AzureService
Get-AzureVM
Set-AzureLoadBalancedEndpoint

@kilasuit
Copy link
Collaborator

@dfr0 - you'll need to raise this in the Azure Powershell repo over at https://github.com/azure/azure-powershell as this isn't a PowerShell issue

@SteveL-MSFT
Copy link
Member

This issue was moved to PowerShell/PowerShellGet#24

@jackfruh
Copy link

note: On OSX 10.11.6, I'm getting:

Install-Package : Unable to find package source 
'https://www.powershellgallery.com/api/v2/'. Use Get-PackageSource to see all 
available package sources.

This is with PS 6 alpha 15
Dot net 1.1 was installed from dotnet-dev-osx-x64.1.0.0-preview2-1-003177.pkg

@SteveL-MSFT SteveL-MSFT added the Resolution-External The issue is caused by external component(s). label Feb 14, 2017
@wooway
Copy link

wooway commented Nov 11, 2018

Above Option 3 using NuGet works.

@MaximoTrinidad
Copy link

We should close this issue.

I can install both Azure module and any package without any issues.
No issues with PowerShell Gallery nor NuGet.

:)

MacOS/Linux/Windows All Good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-PowerShellGet specific to PowerShellGet module OS-macOS Resolution-External The issue is caused by external component(s).
Projects
None yet
Development

No branches or pull requests