ipfs-inactive / dev-team-enablement

[ARCHIVED] Dev Team Enablement Working Group
3 stars 1 forks source link

js-ipfs build on Windows fails due to Python #155

Closed vmx closed 5 years ago

vmx commented 5 years ago

Which Project is this about?

js-ipfs

Provide a link to a example run where it went wrong

https://ci.ipfs.team/job/IPFS/job/js-ipfs/job/PR-1626/6/consoleFull

14:15:38 [windows - 10.11.0] gyp ERR! configure error 
14:15:38 [windows - 10.11.0] gyp ERR! stack Error: Command failed: C:\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
14:15:38 [windows - 10.11.0] gyp ERR! stack   File "<string>", line 1
14:15:38 [windows - 10.11.0] gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
14:15:38 [windows - 10.11.0] gyp ERR! stack                                ^
14:15:38 [windows - 10.11.0] gyp ERR! stack SyntaxError: invalid syntax
14:15:38 [windows - 10.11.0] gyp ERR! stack 
14:15:39 [windows - 10.11.0] gyp ERR! stack     at ChildProcess.exithandler (child_process.js:289:12)
14:15:39 [windows - 10.11.0] gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
14:15:39 [windows - 10.11.0] gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
14:15:39 [windows - 10.11.0] gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

It looks like the Windows worker is using Python 3, but this scrit is clearly using Python 2 syntax.

Which platform did the issue happen on?

Windows

vmx commented 5 years ago

It now seems to be a hard failure: https://ci.ipfs.team/blue/organizations/jenkins/IPLD%2Fjs-ipld/detail/why-so-many-old-node-js-versions/1/pipeline/

daviddias commented 5 years ago

This is making CI red when it is not the case.

vmx commented 5 years ago

My currently proposed fix is to set the npm configuration variable python to c:\python27\python.exe on Windows. That is quick and also easy to debug in case it has unknown side-effects.

Another possible solution (though I was able to reproduce it only once) is to create a symlink to the Python 2.7 executable calles "python2.exe". It seemed that node-gyp was then picking it up correctly. The command to do the symlink would be mklink c:\python27\python2.exe c:\python27\python.exe.