我正在尝试使用 NPM 为 Electron 项目安装 Windows-Build-Tools。但是,当我运行
npm install --global --production windows-build-tools
时,我收到此错误:
Downloading python-2.7.15.amd64.msi
Error: getaddrinfo EAI_AGAIN www.python.org:443
Downloading Python failed. Error: { Error: getaddrinfo EAI_AGAIN www.python.org:443
at Object._errnoException (util.js:992:11)
at errnoException (dns.js:55:15)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
code: 'EAI_AGAIN',
errno: 'EAI_AGAIN',
syscall: 'getaddrinfo',
hostname: 'www.python.org',
host: 'www.python.org',
port: 443 }
windows-build-tools will now exit.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node ./dist/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\blahblah\AppData\Roaming\npm-cache\_logs\2019-06-13T00_02_38_046Z-debug.log
我的机器上已经安装了 python 2.7.16,如果有一种方法可以在不使用 python 的情况下安装这个包,我将不胜感激。
使用镜像链接可以安装Python:
npm --python_mirror=https://npm.taobao.org/mirrors/python/ install --global windows-build-tools
最后,这有效了: github
简单使用即可 工作会很顺利
npm install --global --production [email protected]
npm --python_mirror=https://registry.npmmirror.com/-/binary/python/ install --global windows-build-tools