Skip to content

Python error on installing nodegit 0.0.77 #59

Closed

Description

@dctr

I had nodegit 0.0.74 installed and recently got the update to 77. On 'npm update' i got the error posted below. Obviously, the gyp expects 'python' to be version 2.x. I have python 2 and 3 installed. 'python' is a symlink to python 3.3, while python2 is available on my system for python 2.7.

So: Wouldn't it be possible to try multiple binaries / symlinks via gyp? Maybe: If 'python' is version 3.x, try 'python2'?

Here is the stderr output:
gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v3.3.0, 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 failPythonVersion (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:118:14)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:107:9
gyp ERR! stack at ChildProcess.exithandler (child_process.js:600:7)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at maybeClose (child_process.js:700:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:767:5)
gyp ERR! System Linux 3.8.4-1-ARCH
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--python" "python"
gyp ERR! cwd /home/david/Dokumente/Development/reason/node_modules/nodegit
gyp ERR! node -v v0.10.1
gyp ERR! node-gyp -v v0.8.5
gyp ERR! not ok
npm ERR! nodegit@0.0.77 install: node install.js
npm ERR! sh "-c" "node install.js" failed with 1
npm ERR!
npm ERR! Failed at the nodegit@0.0.77 install script.
npm ERR! This is most likely a problem with the nodegit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls nodegit
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.8.4-1-ARCH
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "update"
npm ERR! cwd /home/david/Dokumente/Development/reason
npm ERR! node -v v0.10.1
npm ERR! npm -v 1.2.15
npm ERR! code ELIFECYCLE

Activity

  1. faceleg commented on Mar 25, 2013

    @faceleg
    Collaborator

    Line 71 of install.js is where it is currently checking for Python availability:

    var pythonExecutable = 'python';
    function checkPython2Exists(callback) {
        exec('which python2',
          function (error) {
            if (error !== null) {
                pythonExecutable = 'python2';
                callback();
                return;
            }
            // python2 is not available, check for python
            exec('which python', function(error) {
                if (error) {
                    throw new Error('Python is required to build libgit2');
                }
                callback();
            });
        });
    },

    Then on line 121 down, the pythonExectuable variable is used in the node-gyp call like this:

    shpassthru('node-gyp configure --python ' + pythonExecutable, callback);

    I'm far from an expert in node-gyp (or Python) - how do you suggest I improve this process to make it compatible with more systems?

  2. ghost assigned on Mar 25, 2013
  3. dctr commented on Mar 26, 2013

    @dctr
    ContributorAuthor

    Wait, 'if (error !== null)'? Shouldn't it be 'if (error === null)' or 'if (!error)'?

    So, if it finds python2, error is null and pythonExecutable is not set, but python is used instead...

  4. dctr commented on Mar 26, 2013

    @dctr
    ContributorAuthor

    Just forked you repo, changed code accordingly and opened a pull request.

    Would be nice if you update the package in NPM after pulling my changes in.

  5. faceleg commented on Mar 26, 2013

    @faceleg
    Collaborator

    Hi @dctr, I pulled & updated the npm package, please close this issue if it is now fixed?

    Thank you very much for submitting your pull request, and sorry I wasn't able to take action on it immediately.

  6. vvo commented on Sep 4, 2013

    @vvo

    For people wondering how to solve this for other npm installs:

    PYTHON=/usr/bin/python2 npm install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions