zoukankan      html  css  js  c++  java
  • Windows 7上执行Cake 报错原因是Powershell 版本问题

    在Windows 7 SP1 电脑上执行Cake的的例子 http://cakebuild.net/docs/tutorials/getting-started ,运行./Build.ps1 报下面的错误

    PS D:WorkshopGitHubcakebuildexample> ./build.ps1 -Target Default

    Preparing to run build script...

    Join-Path : 无法将参数绑定到参数“Path”,因为该参数是空值。

    所在位置 D:WorkshopGitHubcakebuildexampleuild.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:WorkshopGitHubcakebuildexampleuild.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:WorkshopGitHubcakebuildexampleuild.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:WorkshopGitHubcakebuildexampleuild.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:WorkshopGitHubcakebuildexampleuild.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:WorkshopGitHubcakebuildexampleuild.ps1:83 字符: 16

    + if (!(Test-Path <<<< $PACKAGES_CONFIG)) {

    + CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCom

    mand

    Test-Path : 无法将参数绑定到参数“Path”,因为该参数是空值。

    所在位置 D:WorkshopGitHubcakebuildexampleuild.ps1:91 字符: 16

    + if (!(Test-Path <<<< $NUGET_EXE)) {

    + CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCom

    mand

    Test-Path : 无法将参数绑定到参数“Path”,因为该参数是空值。

    所在位置 D:WorkshopGitHubcakebuildexampleuild.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:WorkshopGitHubcakebuildexampleuild.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:WorkshopGitHubcakebuildexampleuild.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:WorkshopGitHubcakebuildexample> $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 ,安装后就可以成功执行了。

    image

     

    相关文章

  • 相关阅读:
    【刷题-LeetCode】154 Find Minimum in Rotated Sorted Array II
    【刷题-LeetCode】153 Find Minimum in Rotated Sorted Array
    【刷题-LeetCode】152 Maximum Product Subarray
    迭代器,生成器
    python 16 装饰器
    python 15 闭包函数
    python 14 名称空间与作用域
    函数参数
    python 11 函数基础
    python中list、tuple、set、dict区别
  • 原文地址:https://www.cnblogs.com/shanyou/p/5599646.html
Copyright © 2011-2022 走看看