azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Install-Module AzureRM fails with PackageManagement\Install-Package: Package 'AzureRM.profile' failed to be installed because: A local file header is corrupt.

Open lambdakris opened this issue 10 years ago • 14 comments

I am using a fresh Windows 10 build 1607 and I am getting the following error when trying to install the AzureRM module: azurerm module installation error

lambdakris avatar Aug 10 '16 15:08 lambdakris

+1 - Receiving this issue as well.

ljtill avatar Aug 10 '16 15:08 ljtill

Hi, @lambdakris please try the following steps:

  1. Install-Module AzureRM.Profile -RequiredVersion 1.0.11
  2. Install-Module AzureRM.Profile -RequiredVersion 2.0.0.0
  3. Install-Module Azure.Storage -RequiredVersion 1.1.5
  4. Install-Module Azure.Storage -RequiredVersion 2.0
  5. Install-Module AzureRM

@lambdakris Please do not follow this advice. This will download unnecessary versions of modules. We are pushing out a new module version, and delisting the 2.0 versions of each of the dependent modules to work around the bug mentioned below in the Gallery.

quoctruong avatar Aug 10 '16 18:08 quoctruong

This problem happens because of the following reason:

  1. AzureRM has lots of dependencies. If you traverse the dependency chain, you will notice different versions of AzureRM.Profile in the dependency chain.
  2. PowerShellGet has a problem installing 2 versions of the same module in 1 Install-Module call

Thanks for reporting the issue. Please use the workaround that @quoctruong mentioned until we fix this issue.

Krishna-Vutukuri avatar Aug 10 '16 19:08 Krishna-Vutukuri

@quoctruong thank you for that, I've just tried it however still receiving the following:

PackageManagement\Install-Package : Package 'AzureRM.profile' failed to be installed because: A local file header is corrupt. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1375 char:21

  • ... $null = PackageManagement\Install-Package @PSBoundParameters
  •                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidResult: (AzureRM.profile:String) [Install-Package], Exception
    • FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

PackageManagement\Install-Package : Collection was modified; enumeration operation may not execute. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1375 char:21

  • ... $null = PackageManagement\Install-Package @PSBoundParameters
  •                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
    • FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

ljtill avatar Aug 10 '16 21:08 ljtill

@ljt91 @quoctruong @KrishnaV-MSFT @lambdakris Just finished a thread with Krishna and Quoc, Krishna's assessment above is not correct. There are not multiple versions of a module in the dependency chain for the AzureRM module. They didn't notice that version 2.0 of Azure and AzureRM were delisted, so that the latest modules are not the ones referenced from AzureRM v 1.6.

According to Quoc, the Gallery is apparently not resolving the dependent module RequiredVersion constraint correctly - the RequiredVersion constraint from the AzureRM module is not being honored when resolving the dependencies for the dependent modules in its chain. I'm told the underlying issue will be fixed.

markcowl avatar Aug 10 '16 22:08 markcowl

This should be resolved when the new version is pushed out (within the hour)

markcowl avatar Aug 10 '16 22:08 markcowl

@lambdakris @ljt91 @anurse @KrishnaV-MSFT @quoctruong This is now resolved. The hotfix modules for 2.0 are out. Please verify, and apologies for the bad experience. We've adjusted our hotfix policies, and we'll work with the PSGet team to ensure this doesn't happen again when pulling back a module.

markcowl avatar Aug 10 '16 23:08 markcowl

@markcowl I can confirm that it's resolved from my side. All installed and working. Thank you very much for getting the fix out so quickly.

ljtill avatar Aug 10 '16 23:08 ljtill

closing for now

markcowl avatar Aug 10 '16 23:08 markcowl

I am running into this issue. Please help!!!!

rachelgshaffer avatar Sep 21 '18 18:09 rachelgshaffer

@rachelgshaffer would you mind running the following two commands and returning the results?

  • Get-Module -ListAvailable
  • Install-Module -Name AzureRM -Repository PSGallery

cormacpayne avatar Sep 25 '18 21:09 cormacpayne

Closing as no repro

markcowl avatar Oct 13 '18 00:10 markcowl

I tried to install AzSk with the following command : iwr 'https://aka.ms/azsk/install.ps1' -UseBasicParsing | iex

I am getting the following error :

image

ShubhamThakkar avatar Oct 16 '18 10:10 ShubhamThakkar

I am also having this issue trying to install AzureRM 6.8.1 module. Something is wrong with AzureRM.Profile 5.5.1 version. Is someone going to fix this?

MetehanBolat avatar Oct 19 '18 11:10 MetehanBolat