node.jsnpmelectron

Windows-Build-Tools cannot download python


I'm trying to install Windows-Build-Tools for an Electron project, using NPM. However when I run npm install --global --production windows-build-tools, I get this error:

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! windows-build-tools@5.1.0 postinstall: `node ./dist/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the windows-build-tools@5.1.0 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

I already have python 2.7.16 installed on my machine and I would appreciate it if there's a way to install this package without python.

I'm doing this


Solution

  • Using a mirror link worked for installing Python:

     npm --python_mirror=https://npm.taobao.org/mirrors/python/ install --global windows-build-tools
    

    finally, this worked: github