Sitecore 安装框架因 "Path" 上的错误而失败
Sitecore Installation Framework fails with error on "Path"
我正在设置一些脚本,让我们团队的开发人员能够轻松设置本地开发环境。除了安装 Sitecore DB 和 Web 根目录的最后一步外,我的所有安装脚本都运行良好。这是脚本:
#define parameters
$prefix = "dev"
$PSScriptRoot = "."
$XConnectCollectionService = "$prefix.xconnect"
$sitecoreSiteName = "$prefix.sc"
$SolrUrl = "https://solr:8983/solr"
$SolrRoot = "C:\solr\solr-6.6.2"
$SolrService = "solr-6.6.2"
$SqlServer = ".\SQLEXPRESS"
$SqlAdminUser = "sa"
$SqlAdminPassword="password"
#install sitecore instance
$sitecoreParams = @{
Path = "$PSScriptRoot\Packages\sitecore-XP0.json"
Package = "$PSScriptRoot\Packages\Sitecore 9.0.1 rev. 171219 (OnPrem)_single.scwdp.zip"
LicenseFile = "$PSScriptRoot\Packages\license.xml"
SqlDbPrefix = $prefix
SqlServer = $SqlServer
SqlAdminUser = $SqlAdminUser
SqlAdminPassword = $SqlAdminPassword
SolrCorePrefix = $prefix
SolrUrl = $SolrUrl
XConnectCert = $certParams.CertificateName
Sitename = $sitecoreSiteName
XConnectCollectionService = "https://$XConnectCollectionService" }
Install-SitecoreConfiguration $sitecoreParams
这是我在 运行 脚本时遇到的错误。立即发生。
Install-SitecoreConfiguration : Cannot validate argument on parameter 'Path'. The " Test-Path $_ -Type Leaf "
validation script for the argument with value "System.Collections.Hashtable" did not return a result of True.
Determine why the validation script failed, and then try the command again.
At C:\setup\sitecore-dev-install-sc.ps1:18 char:31
+ Install-SitecoreConfiguration $sitecoreParams
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Install-SitecoreConfiguration], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Install-SitecoreConfiguration
所有先决条件都已安装,所有其他使用相同变量的脚本 运行 很好,就像 xconnect 安装一样,非常相似。 JSON 配置文件来自从 Sitecore 网站下载的 XP Single 包。有什么想法会导致这种情况吗?关于如何进一步调试有什么想法吗?
PowerShell 中的变量使用 $
声明和引用,例如$sitecoreParams
在你的脚本中是一个 hashtable
变量。
调用函数时,您可以使用哈希表为函数构建所有参数,然后将单个变量传递给函数。这被称为 Splatting。 Splatting 分解哈希表中的每个 key/value 并作为匹配 parameter/value 传递给函数
语法略有不同:
# This passes a single hashtable parameter
Install-SitecoreConfiguration $sitecoreParams
#This 'splats' the hashtable passing each key/value as a parameter
Install-SitecoreConfiguration @sitecoreParams
展开时,变量的 $
被替换为 @
。
在您的脚本中,您将 $sitecoreParams
作为第一个参数传递给 Install-SitecoreConfiguration
。该函数假定第一个参数为 Path
,因此尝试将其验证为真实文件路径。
解决方法是传递 @sitecoreParams
,以便将散列表放入函数中。
您可以通过 运行:
找到更多关于 Splatting 的信息
Get-Help about_Splatting -ShowWindow
请安装以下软件试试。安装软件后需要重启。
Microsoft ODBC Driver 13 for SQL Server
Microsoft Command Line Utilities 13 for SQL Server
注意:如果您无法为 SQL 服务器 安装 Microsoft ODBC 驱动程序 13,因为版本更高,请继续安装 SQL 服务器
的 Microsoft 命令行实用程序 13
希望对您有所帮助。
我正在设置一些脚本,让我们团队的开发人员能够轻松设置本地开发环境。除了安装 Sitecore DB 和 Web 根目录的最后一步外,我的所有安装脚本都运行良好。这是脚本:
#define parameters
$prefix = "dev"
$PSScriptRoot = "."
$XConnectCollectionService = "$prefix.xconnect"
$sitecoreSiteName = "$prefix.sc"
$SolrUrl = "https://solr:8983/solr"
$SolrRoot = "C:\solr\solr-6.6.2"
$SolrService = "solr-6.6.2"
$SqlServer = ".\SQLEXPRESS"
$SqlAdminUser = "sa"
$SqlAdminPassword="password"
#install sitecore instance
$sitecoreParams = @{
Path = "$PSScriptRoot\Packages\sitecore-XP0.json"
Package = "$PSScriptRoot\Packages\Sitecore 9.0.1 rev. 171219 (OnPrem)_single.scwdp.zip"
LicenseFile = "$PSScriptRoot\Packages\license.xml"
SqlDbPrefix = $prefix
SqlServer = $SqlServer
SqlAdminUser = $SqlAdminUser
SqlAdminPassword = $SqlAdminPassword
SolrCorePrefix = $prefix
SolrUrl = $SolrUrl
XConnectCert = $certParams.CertificateName
Sitename = $sitecoreSiteName
XConnectCollectionService = "https://$XConnectCollectionService" }
Install-SitecoreConfiguration $sitecoreParams
这是我在 运行 脚本时遇到的错误。立即发生。
Install-SitecoreConfiguration : Cannot validate argument on parameter 'Path'. The " Test-Path $_ -Type Leaf " validation script for the argument with value "System.Collections.Hashtable" did not return a result of True. Determine why the validation script failed, and then try the command again. At C:\setup\sitecore-dev-install-sc.ps1:18 char:31 + Install-SitecoreConfiguration $sitecoreParams + ~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Install-SitecoreConfiguration], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Install-SitecoreConfiguration
所有先决条件都已安装,所有其他使用相同变量的脚本 运行 很好,就像 xconnect 安装一样,非常相似。 JSON 配置文件来自从 Sitecore 网站下载的 XP Single 包。有什么想法会导致这种情况吗?关于如何进一步调试有什么想法吗?
PowerShell 中的变量使用 $
声明和引用,例如$sitecoreParams
在你的脚本中是一个 hashtable
变量。
调用函数时,您可以使用哈希表为函数构建所有参数,然后将单个变量传递给函数。这被称为 Splatting。 Splatting 分解哈希表中的每个 key/value 并作为匹配 parameter/value 传递给函数
语法略有不同:
# This passes a single hashtable parameter
Install-SitecoreConfiguration $sitecoreParams
#This 'splats' the hashtable passing each key/value as a parameter
Install-SitecoreConfiguration @sitecoreParams
展开时,变量的 $
被替换为 @
。
在您的脚本中,您将 $sitecoreParams
作为第一个参数传递给 Install-SitecoreConfiguration
。该函数假定第一个参数为 Path
,因此尝试将其验证为真实文件路径。
解决方法是传递 @sitecoreParams
,以便将散列表放入函数中。
您可以通过 运行:
找到更多关于 Splatting 的信息Get-Help about_Splatting -ShowWindow
请安装以下软件试试。安装软件后需要重启。
Microsoft ODBC Driver 13 for SQL Server
Microsoft Command Line Utilities 13 for SQL Server
注意:如果您无法为 SQL 服务器 安装 Microsoft ODBC 驱动程序 13,因为版本更高,请继续安装 SQL 服务器
的 Microsoft 命令行实用程序 13希望对您有所帮助。