compose-init.ps1スクリプトを実行した際に、以下のエラーがログ レコードに出力される場合があります:
PackageManagement\Register-PackageSource : Module Repository 'SitecoreGallery' exists.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.1.4\PSModule.psm1:11325 char:17
+ ... $null = PackageManagement\Register-PackageSource @PSBoundParamete ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceExists: (Microsoft.Power...erPackageSource:RegisterPackageSource) [Register-PackageSource], Exception
+ FullyQualifiedErrorId : PackageSourceExists,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSource
このエラーは、SitecoreGallery PS Galleryが登録されているマシンで、このスクリプトが複数回実行された場合に発生します。
エラーが表示されることを除けば、このバグがスクリプトの実行中に他の問題を引き起こすことはありません。.envの値および証明書は正しく初期化されますので、このスクリプトによるエラーは無視しても問題ありません。このエラーを解消されたい場合は、以下の解決策の適用をご検討ください。
解決策として、以下の手順を実施してください:
# Check for Sitecore Gallery
Import-Module PowerShellGet
$SitecoreGallery = Get-PSRepository | Where-Object { $_.SourceLocation -match 'Sitecore_Gallery' }
if (-not $SitecoreGallery) {
Write-Host "Adding Sitecore PowerShell Gallery..." -ForegroundColor Green
Register-PSRepository -Name SitecoreGallery -SourceLocation $SitecoreGalleryRepositoryLocation -InstallationPolicy Trusted
$SitecoreGallery = Get-PSRepository -Name SitecoreGallery
}
# Check for Sitecore Gallery
Import-Module PowerShellGet
$SitecoreGalleryName = 'SitecoreGallery'
$SitecoreGallery = Get-PSRepository | Where-Object { $_.Name -eq $SitecoreGalleryName }
if (-not $SitecoreGallery) {
Write-Host "Adding Sitecore PowerShell Gallery..." -ForegroundColor Green
Register-PSRepository -Name $SitecoreGalleryName -SourceLocation $SitecoreGalleryRepositoryLocation -InstallationPolicy Trusted
$SitecoreGallery = Get-PSRepository -Name $SitecoreGalleryName
}