Skip to content

Should intelligently try to detect Python 2.7 #1266

@cwallenpoole

Description

@cwallenpoole

Having to install a virtualenv to get a node project working is counter intuitive.

If you were using hasbin, you could change this:

39   findPython(python, function (err, found) {
 40     if (err) {
 41       callback(err)
 42     } else {
 43       python = found
 44       getNodeDir()
 45     }
 46   })

To:

 39   findPython(python, function (err, found) {
 40     if (err) {
 41       if (!(gyp.opts.python || process.env.PYTHON) && hasbin.sync('python2.7')) {
 42         python = 'python2.7'
 43       } else {
 44         callback(err)
 45         return;
 46       }
 47     }
 48
 49     python = found
 50     getNodeDir()
 51   })
  • Node Version: 8
  • Platform: OSX
  • Compiler: Irreelvant
  • Module: Irrelevant, happens with every related gyp module
Verbose output (from npm or node-gyp):
gyp ERR! configure error
gyp ERR! stack Error: Python executable "/Users/christopherallen-poole/anaconda/bin/python" is v3.5.2, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at PythonFinder.failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:492:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:474:14)
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:262:7)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:921:16)
gyp ERR! stack     at Socket.stream.socket.on (internal/child_process.js:348:11)
gyp ERR! stack     at emitOne (events.js:115:13)
gyp ERR! stack     at Socket.emit (events.js:210:7)
gyp ERR! stack     at Pipe._handle.close [as _onclose] (net.js:549:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions