前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Windows 7上执行Cake 报错原因是Powershell 版本问题

Windows 7上执行Cake 报错原因是Powershell 版本问题

作者头像
张善友
发布2018-01-22 16:18:57
1.6K0
发布2018-01-22 16:18:57
举报
文章被收录于专栏:张善友的专栏张善友的专栏

在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 ,安装后就可以成功执行了。

image
image

相关文章

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-06-20 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档