当我使用以下命令时:
npm install -g protractor
它失败并给我以下错误:
LINK : fatal error LNK1181: cannot open input file 'gdi32.lib' [C:\Users\Develo per\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver \node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj] gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074
:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Developer\AppData\Roaming\npm\node_modules\protractor\node
_modules\selenium-webdriver\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
> utf-8-validate@1.1.0 install C:\Users\Developer\AppData\Roaming\npm\node_modul
es\protractor\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8
-validate
> node-gyp rebuild
C:\Users\Developer\AppData\Roaming\npm\node_modules\protractor\node_modules\sele
nium-webdriver\node_modules\ws\node_modules\utf-8-validate>if not defined npm_co
nfig_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\
..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (rebuild)
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
validation.cc
LINK : fatal error LNK1181: cannot open input file 'gdi32.lib' [C:\Users\Develo
per\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:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074
:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Developer\AppData\Roaming\npm\node_modules\protractor\node
_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing bufferutil@1.1.0
npm WARN optional dep failed, continuing utf-8-validate@1.1.0
C:\Users\Developer\AppData\Roaming\npm\protractor -> C:\Users\Developer\AppData\
Roaming\npm\node_modules\protractor\bin\protractor
C:\Users\Developer\AppData\Roaming\npm\webdriver-manager -> C:\Users\Developer\A
ppData\Roaming\npm\node_modules\protractor\bin\webdriver-manager
protractor@2.1.0 C:\Users\Developer\AppData\Roaming\npm\node_modules\protractor
├── jasminewd@1.1.0
├── jasminewd2@0.0.5
├── html-entities@1.1.2
├── saucelabs@0.1.1
├── q@1.0.0
├── minijasminenode@1.1.1
├── adm-zip@0.4.4
├── lodash@2.4.2
├── accessibility-developer-tools@2.6.0
├── optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
├── jasmine@2.3.1 (exit@0.1.2, jasmine-core@2.3.4)
├── glob@3.2.11 (inherits@2.0.1, minimatch@0.3.0)
├── source-map-support@0.2.10 (source-map@0.1.32)
├── request@2.36.0 (forever-agent@0.5.2, aws-sign2@0.5.0, oauth-sign@0.3.0, tunn
el-agent@0.4.0, qs@0.6.6, json-stringify-safe@5.0.1, mime@1.2.11, node-uuid@1.4.
3, tough-cookie@2.0.0, http-signature@0.10.1, hawk@1.0.0, form-data@0.1.4)
└── selenium-webdriver@2.45.1 (tmp@0.0.24, rimraf@2.4.0, xml2js@0.4.4, ws@0.7.2)
知道如何解决这个问题吗?
我需要支持。
答案 0 :(得分:0)
我在Windows 10上安装VS 2015后卸载Visual Studio 2013时发生此错误。
帮助我的是纠正node-gyp的依赖关系!
只需按照Windows上node-gyp的安装说明操作,然后一切都可以正常运行:https://github.com/nodejs/node-gyp