我正在尝试使用以下命令在Windows 10上安装Electron:
- git clone https://github.com/electron/electron-quick-start
- cd electron-quick-start
- npm install
- npm start
我已经设置了环境变量
USERPROFILE%/AppData/Roaming/npm/node_modules/@angular/cli/bin
%USERPROFILE%/AppData/Roaming/npm
我正在遵循此site的脚步,但是在提供 npm install
时,我仍然遇到这些错误PS C:\Users\PC\Desktop\project\electron-quick-start> npm install
> electron@6.0.11 postinstall C:\Users\PC\Desktop\project\electron-quick-start\node_modules\electron
> node install.js
Downloading tmp-15380-0-electron-v6.0.11-win32-x64.zip
Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:80
C:\Users\PC\Desktop\project\electron-quick-start\node_modules\electron\install.js:49
throw err
^
Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:80
at ClientRequest.onError (C:\Users\PC\Desktop\project\electron-quick-start\node_modules\tunnel-agent\index.js:177:17)
at Object.onceWrapper (events.js:286:20)
at ClientRequest.emit (events.js:198:13)
at Socket.socketErrorListener (_http_client.js:392:9)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm WARN rollback Rolling back debug@2.6.9 failed (this is probably harmless): EPERM: operation not permitted, scandir 'C:\Users\PC\Desktop\project\electron-quick-start\node_modules\sumchecker\node_modules'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@6.0.11 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@6.0.11 postinstall 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\PC\AppData\Roaming\npm-cache\_logs\2019-10-08T15_02_16_542Z-debug.log
PS C:\Users\PC\Desktop\project\electron-quick-start>
这是生成的 log
到目前为止,我使用的节点是最新版本 10.16.3 和npm 6.11.3 。
该怎么办才能解决此错误?
答案 0 :(得分:0)
尝试以下方法:
npm config set proxy http://yourproxyaddress:port
npm config set https-proxy http://yourproxyaddress:port
npm config set strict-ssl false
IE
npm config set registry=http://registry.npmjs.org/
npm config set strict-ssl false
这应该可以解决您遇到的错误。如果全部失败,则可能已在.npmrc
中添加了以下内容registry=https://registry.npmjs.org/
proxy=http://username:password@127.0.0.1:8888
https-proxy=http://username:password@127.0.0.1:8888
http-proxy=http://username:password@127.0.0.1:8888
strict-ssl=false
ca=null