在Windows 7 SP1 電腦上執行Cake的的例子 http://cakebuild.net/docs/tutorials/getting-started ,運行./Build.ps1 報下面的錯誤
PS D:\Workshop\GitHub\cakebuildexample> ./build.ps1 -Target Default
Preparing to run build script...
Join-Path : 無法將參數綁定到參數“Path”,因為該參數是空值。
所在位置 D:\Workshop\GitHub\cakebuildexample\build.ps1:50 字符: 23
+ $TOOLS_DIR = Join-Path <<<< $PSScriptRoot "tools"
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCom
mand
Join-Path : 無法將參數綁定到參數“Path”,因為該參數是空值。
所在位置 D:\Workshop\GitHub\cakebuildexample\build.ps1:51 字符: 23
+ $NUGET_EXE = Join-Path <<<< $TOOLS_DIR "nuget.exe"
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCom
mand
Join-Path : 無法將參數綁定到參數“Path”,因為該參數是空值。
所在位置 D:\Workshop\GitHub\cakebuildexample\build.ps1:53 字符: 22
+ $CAKE_EXE = Join-Path <<<< $TOOLS_DIR "Cake/Cake.exe"
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCom
mand
Join-Path : 無法將參數綁定到參數“Path”,因為該參數是空值。
所在位置 D:\Workshop\GitHub\cakebuildexample\build.ps1:54 字符: 29
+ $PACKAGES_CONFIG = Join-Path <<<< $TOOLS_DIR "packages.config"
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCom
mand
Test-Path : 無法將參數綁定到參數“Path”,因為該參數是空值。
所在位置 D:\Workshop\GitHub\cakebuildexample\build.ps1:77 字符: 15
+ if ((Test-Path <<<< $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCom
mand
Test-Path : 無法將參數綁定到參數“Path”,因為該參數是空值。
所在位置 D:\Workshop\GitHub\cakebuildexample\build.ps1:83 字符: 16
+ if (!(Test-Path <<<< $PACKAGES_CONFIG)) {
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCom
mand
Test-Path : 無法將參數綁定到參數“Path”,因為該參數是空值。
所在位置 D:\Workshop\GitHub\cakebuildexample\build.ps1:91 字符: 16
+ if (!(Test-Path <<<< $NUGET_EXE)) {
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCom
mand
Test-Path : 無法將參數綁定到參數“Path”,因為該參數是空值。
所在位置 D:\Workshop\GitHub\cakebuildexample\build.ps1:102 字符: 16
+ if (!(Test-Path <<<< $NUGET_EXE)) {
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCom
mand
Set-Location : 無法處理參數,因為參數“path”的值為空。請將參數“path”的值更改為非空值。
所在位置 D:\Workshop\GitHub\cakebuildexample\build.ps1:119 字符: 17
+ Set-Location <<<< $TOOLS_DIR
+ CategoryInfo : InvalidArgument: (:) [Set-Location], PSArgumentNullException
+ FullyQualifiedErrorId : ArgumentNull,Microsoft.PowerShell.Commands.SetLocationCommand
管道元素中“&”后的表達式生成的對象無效。該表達式必須生成命令名稱、腳本塊或 CommandInfo 對象。
所在位置 行:1 字符: 2
+ & <<<< "" install -ExcludeVersion -OutputDirectory ""
+ CategoryInfo : InvalidOperation: (:String) [], RuntimeException
+ FullyQualifiedErrorId : BadExpression
Test-Path : 無法將參數綁定到參數“Path”,因為該參數是空值。
所在位置 D:\Workshop\GitHub\cakebuildexample\build.ps1:133 字符: 16
+ if (!(Test-Path <<<< $CAKE_EXE)) {
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCom
mand
Running build script...
管道元素中“&”后的表達式生成的對象無效。該表達式必須生成命令名稱、腳本塊或 CommandInfo 對象。
所在位置 行:1 字符: 2
+ & <<<< "" "build.cake" -target="Default" -configuration="Release" -verbosity="Verbose"
+ CategoryInfo : InvalidOperation: (:String) [], RuntimeException
+ FullyQualifiedErrorId : BadExpression
上述報錯有很多,問題的根源是PowerShell的版本問題,查了下我機器上是2.0版本的
PS D:\Workshop\GitHub\cakebuildexample> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 –1
解決辦法就是升級(建議升級3.0 能夠成功解決),Windows Management Framework 3.0 下載地址:https://www.microsoft.com/en-us/download/details.aspx?id=34595 ,安裝后就可以成功執行了。
相關文章
文章列表