在Windows 10上安装Electron(`node-gyp rebuild`错误)

时间:2017-09-25 04:57:05

标签: python-2.7 npm electron node-gyp

我已经看到了很多Stack帖子和GitHub帖子,但我已经走到了尽头,我不知道还有什么地方可以转向(道歉,如果重复)。

我正在按照指南here安装Electron。在命令npm install --runtime=electron --target=1.4.15上,我点击了公共堆栈:

> msgpack@1.0.2 install D:\Research Documents\Fall 2017 - Work\Lab Work\sample_app\node_modules\msgpack
> node-gyp rebuild


D:\Research Documents\Fall 2017 - Work\Lab Work\sample_app\node_modules\msgpack>if not defined npm_config_n
ode_gyp (node "C:\Users\User Name\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp
\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: 404 response downloading https://iojs.org/download/release/v1.4.15/iojs-v1.4.15.tar.gz
gyp ERR! stack     at Request.<anonymous> (C:\Users\User Name\AppData\Roaming\npm\node_modules\npm\node_modules\node
-gyp\lib\install.js:210:14)
gyp ERR! stack     at emitOne (events.js:101:20)
gyp ERR! stack     at Request.emit (events.js:188:7)
gyp ERR! stack     at Request.onRequestResponse (C:\Users\User Name\AppData\Roaming\npm\node_modules\npm\node_module
s\request\request.js:1074:10)
gyp ERR! stack     at emitOne (events.js:96:13)
gyp ERR! stack     at ClientRequest.emit (events.js:188:7)
gyp ERR! stack     at HTTPParser.parserOnIncomingClient (_http_client.js:473:21)
gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:362:20)
gyp ERR! stack     at emitOne (events.js:96:13)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\User Name\\AppData\\Roaming\\npm\\node_modules\\n
pm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Research Documents\Fall 2017 - Work\Lab Work\sample_app\node_modules\msgpack
gyp ERR! node -v v6.10.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN gnomics@ No description
npm WARN gnomics@ No repository field.
npm WARN gnomics@ No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! msgpack@1.0.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the msgpack@1.0.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\User Name\AppData\Roaming\npm-cache\_logs\2017-09-25T04_40_03_337Z-debug.log

本指南建议通过运行成功运行的npm install --global --production windows-build-tools从源构建,但即使在清除缓存后,Electron install命令仍然会产生相同的错误。

我的PATH变量和PYTHON变量中有Python2.7,正如一些Stack答案所示。

有趣的是,运行npm config -g set msvs_version 2015后跟npm i工作。然后运行Electron install命令似乎工作,直到我运行测试./node_modules/.bin/electron,产生:

D:\Research Documents\Fall 2017 - Work\Lab Work\sample_app\node_modules\electron\index.js:9
  throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
  ^

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
    at Object.<anonymous> (D:\Research Documents\Fall 2017 - Work\Lab Work\sample_app\node_modules\electron
\index.js:9:9)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (D:\Research Documents\Fall 2017 - Work\Lab Work\sample_app\node_modules\electron
\cli.js:3:16)
    at Module._compile (module.js:570:32)

这一切都在x64 Windows 10系统上运行。我在Windows PowerShell上尝试了以上所有内容(作为管理员,而不是管理员),在命令提示符下(作为管理员而非管理员),以及在Git Bash上,所有这些都有相同的错误消息。

任何帮助将不胜感激! (如果需要任何其他信息,例如Microsoft Visual Studio,SDK或其他安装,请告诉我哪些,我会相应更新。)

编辑1:请注意,将所有内容作为单个命令运行,即npm install --global --production --runtime=electron --target=1.4.15 --build-from-source windows-build-tools也不起作用(安装完成没有错误,但Electron仍然说它无法正确安装)。

更新1:好的,所以我删除了所有内容并清除了缓存,然后我运行了npm config -g set msvs_version 2015,然后是npm i,然后是npm install --runtime=electron --target=1.4.15。接下来,我运行了./node_modules/.bin/electron。但是,启动实际项目会产生一个新的电子错误......所以我认为我并没有真正“解决”任何问题。新错误是:

D:\Research Documents\Fall 2017 - Work\Lab Work\sample_app\node_modules\bindings\bindings.js:83 Uncaught Error: A dynamic link library (DLL) initialization routine failed.
\\?\D:\Research Documents\Fall 2017 - Work\Lab Work\sample_app\node_modules\zmq\build\Release\zmq.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at bindings (D:\Research Documents\Fall 2017 - Work\Lab Work\sample_app\node_modules\bindings\bindings.js:76:44)
    at Object.<anonymous> (D:\Research Documents\Fall 2017 - Work\Lab Work\sample_app\node_modules\zmq\lib\index.js:6:30)

0 个答案:

没有答案