【问题标题】:error on npm install -g protractornpm install -g protractor 出错
【发布时间】:2016-02-20 06:46:35
【问题描述】:

安装量角器时出现此错误:

C:\Users\andreir\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-validate>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'validation.vcxproj' is invalid. Platform='x64'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Platform that doesn't exist for this project. [C:\Users\andreir\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-validate\build\validation.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\andreir\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v0.10.38
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok

我不明白错误在哪里......

我有(相关的): Windows 8.1 专业版 x64, 蟒蛇2.7.10, VS 2012 专业版

【问题讨论】:

    标签: node.js 64-bit npm protractor platform


    【解决方案1】:

    正如错误所说,问题是由于WebSocket所需的utf-8-validate模块的编译selenium-webdriver所需的

    node_modules\protractor\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-validate
    

    编译器找不到 x64 的项目配置

    The Platform for project 'validation.vcxproj' is invalid. Platform='x64'
    

    在这个Github Issue 中,解决方案是重新安装 VisualStudio 和 Windows SDK。

    无论如何,这是一个可选的依赖项,所以你可以不用它,当你弄清楚它,运行时

    npm install --no-optional
    

    【讨论】:

    • 通过安装 VS2010 得到帮助。谢谢!
    猜你喜欢
    • 2017-06-07
    • 1970-01-01
    • 2013-12-14
    • 2019-05-16
    • 2020-12-19
    • 2021-02-27
    • 2018-10-29
    • 2017-02-18
    • 2013-05-20
    相关资源
    最近更新 更多