{"action":"closed","issue":{"url":"https://api.github.com/repos/electron-userland/electron-builder/issues/638","repository_url":"https://api.github.com/repos/electron-userland/electron-builder","labels_url":"https://api.github.com/repos/electron-userland/electron-builder/issues/638/labels{/name}","comments_url":"https://api.github.com/repos/electron-userland/electron-builder/issues/638/comments","events_url":"https://api.github.com/repos/electron-userland/electron-builder/issues/638/events","html_url":"https://github.com/electron-userland/electron-builder/issues/638","id":169229266,"number":638,"title":"node-gyp fails build because it can't find python2","user":{"login":"SimplyAhmazing","id":1294344,"avatar_url":"https://avatars.githubusercontent.com/u/1294344?v=3","gravatar_id":"","url":"https://api.github.com/users/SimplyAhmazing","html_url":"https://github.com/SimplyAhmazing","followers_url":"https://api.github.com/users/SimplyAhmazing/followers","following_url":"https://api.github.com/users/SimplyAhmazing/following{/other_user}","gists_url":"https://api.github.com/users/SimplyAhmazing/gists{/gist_id}","starred_url":"https://api.github.com/users/SimplyAhmazing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimplyAhmazing/subscriptions","organizations_url":"https://api.github.com/users/SimplyAhmazing/orgs","repos_url":"https://api.github.com/users/SimplyAhmazing/repos","events_url":"https://api.github.com/users/SimplyAhmazing/events{/privacy}","received_events_url":"https://api.github.com/users/SimplyAhmazing/received_events","type":"User","site_admin":false},"labels":[{"id":373647727,"url":"https://api.github.com/repos/electron-userland/electron-builder/labels/backlog","name":"backlog","color":"d93f0b","default":false},{"id":214243370,"url":"https://api.github.com/repos/electron-userland/electron-builder/labels/help%20wanted","name":"help wanted","color":"159818","default":true},{"id":269626534,"url":"https://api.github.com/repos/electron-userland/electron-builder/labels/investigate","name":"investigate","color":"fef2c0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-03T20:44:31Z","updated_at":"2017-01-04T20:39:13Z","closed_at":"2017-01-04T20:39:13Z","body":"<!-- Which version of electron-builder are you using? -->\n- **5.22.1**: \n\n<!-- What target are you building for? -->\n- **mac**: \n\n<!-- Enter your issue details below this comment. -->\n\nI have an electron project which uses a python 3 environment for a segment of the app and thus the entirety of my repo's environment is python 3.\n\nWhen I run `build -m --x64` to build for Mac (or the equivalent for windows) I get an error that `node-gyp` can't find python2. I know that node-gyp is not compatible with python3.. I normally have `npm` set to use `python 2` for `node-gyp` with:`npm config set python /usr/bin/python2.7`\n\nAnd anytime I use npm within a python 3 environment I don't get an error about node-gpy not finding python2.\n\nAlso, within my project which has `python 3.4.3` I can run electron-packager and create windows/mac builds without any errors from `node-gyp` being unable to find python 2.\n\nBut when I run `electron-builder` it seems that my environment has to be set to python 2. Two question I have are,\n1. How can I tell `electron-builder` the path to python 2 when it invokes node-gyp/electron-packager (if I understand how things work internally and I may not)...\n2. How is that `electron-packager` can package the same app in a python 3 environment but `electron-builder` needs the environments python to be strictly python 2 to work...\n\nRight now I build a segment of my application using python 3 then switch to python 2 to build the rest since I've switched from electron-packager to electron-builder..\n\nI can write scripts locally and on our CI (travis, appveyor) that do this python version switching but I'm hoping that won't be unnecessary. For now I'll have to do that to finish my work..\n\nBelow is the node-gyp error I get because my environment is in python 3,\n\n```\n$ build -m --x64                            \nRebuilding app dependencies for arch x64 to /Users/moi/Code/foo/otone_frontend/app\n\ngyp ERR! configure error\ngyp ERR! stack Error: Command failed: /opt/boxen/pyenv/shims/python2 -c import platform; print(platform.python_version());\ngyp ERR! stack pyenv: python2: command not found\ngyp ERR! stack\ngyp ERR! stack The `python2' command exists in these Python versions:\ngyp ERR! stack   2.7.5\ngyp ERR! stack   2.7.7\ngyp ERR! stack   2.7.9\ngyp ERR! stack\ngyp ERR! stack\ngyp ERR! stack     at ChildProcess.exithandler (child_process.js:202:12)\ngyp ERR! stack     at emitTwo (events.js:106:13)\ngyp ERR! stack     at ChildProcess.emit (events.js:191:7)\ngyp ERR! stack     at maybeClose (internal/child_process.js:850:16)\ngyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:323:11)\ngyp ERR! stack     at emitOne (events.js:96:13)\ngyp ERR! stack     at Socket.emit (events.js:188:7)\ngyp ERR! stack     at Pipe._handle.close [as _onclose] (net.js:485:12)\ngyp ERR! System Darwin 13.4.0\ngyp ERR! command \"/opt/boxen/nodenv/versions/v6.0.0/bin/node\" \"/opt/boxen/nodenv/versions/v6.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"\ngyp ERR! cwd /Users/moi/Code/foo/otone_frontend/app/node_modules/bufferutil\ngyp ERR! node -v v6.0.0\ngyp ERR! node-gyp -v v3.3.1\ngyp ERR! not ok\n\nnpm ERR! Darwin 13.4.0\nnpm ERR! argv \"/opt/boxen/nodenv/versions/v6.0.0/bin/node\" \"/opt/boxen/nodenv/versions/v6.0.0/bin/npm\" \"rebuild\" \"--production\"\nnpm ERR! node v6.0.0\nnpm ERR! npm  v3.8.6\nnpm ERR! code ELIFECYCLE\nnpm ERR! bufferutil@1.2.1 install: `node-gyp rebuild`\nnpm ERR! Exit status 1\nnpm ERR!\nnpm ERR! Failed at the bufferutil@1.2.1 install script 'node-gyp rebuild'.\nnpm ERR! Make sure you have the latest version of node.js and npm installed.\nnpm ERR! If you do, this is most likely a problem with the bufferutil package,\nnpm ERR! not with npm itself.\nnpm ERR! Tell the author that this fails on your system:\nnpm ERR!     node-gyp rebuild\nnpm ERR! You can get information on how to open an issue for this project with:\nnpm ERR!     npm bugs bufferutil\nnpm ERR! Or if that isn't available, you can get their info via:\nnpm ERR!     npm owner ls bufferutil\nnpm ERR! There is likely additional logging output above.\n\nnpm ERR! Please include the following file with any support request:\nnpm ERR!     /Users/moi/Code/foo/otone_frontend/app/npm-debug.log\nError: npm exited with code 1\n    at ChildProcess.childProcess.on.code (/Users/moi/Code/foo/otone_frontend/node_modules/electron-builder/src/util/util.ts:132:14)\n    at emitTwo (events.js:106:13)\n    at ChildProcess.emit (events.js:191:7)\n    at maybeClose (internal/child_process.js:850:16)\n    at Socket.<anonymous> (internal/child_process.js:323:11)\n    at emitOne (events.js:96:13)\n    at Socket.emit (events.js:188:7)\n    at Pipe._handle.close [as _onclose] (net.js:485:12)\nFrom previous event:\n    at spawn (/Users/moi/Code/foo/otone_frontend/node_modules/electron-builder/src/util/util.ts:109:9)\n    at spawnNpmProduction (/Users/moi/Code/foo/otone_frontend/node_modules/electron-builder/src/util/util.ts:43:9)\n    at Object.installDependencies (/Users/moi/Code/foo/otone_frontend/node_modules/electron-builder/src/util/util.ts:21:120)\n    at Packager.<anonymous> (/Users/moi/Code/foo/otone_frontend/node_modules/electron-builder/src/packager.ts:214:34)\n    at next (native)\n    at tryOnImmediate (timers.js:543:15)\n    at processImmediate [as _immediateCallback] (timers.js:523:5)\nFrom previous event:\n    at tsAwaiter (/Users/moi/Code/foo/otone_frontend/node_modules/electron-builder/src/util/awaiter.ts:10:47)\n    at Object.build (/Users/moi/Code/foo/otone_frontend/node_modules/electron-builder/src/builder.ts:195:52)\n    at Object.<anonymous> (/Users/moi/Code/foo/otone_frontend/node_modules/electron-builder/src/build-cli.ts:27:28)\n    at Module._compile (module.js:541:32)\n    at Object.Module._extensions..js (module.js:550:10)\n    at Module.load (module.js:456:32)\n    at tryModuleLoad (module.js:415:12)\n    at Function.Module._load (module.js:407:3)\n    at Function.Module.runMain (module.js:575:10)\n    at startup (node.js:159:18)\n    at node.js:444:3\n```\n"}}
{"actor":{"display_login":"SimplyAhmazing"}}