找不到Python可执行文件“/path/to/executable/python2.7”,可以设置PYTHON env变量

时间:2016-01-02 20:49:24

标签: node.js polymer-1.0 node-gyp npm-install

  

bufferutil@1.2.1 install /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/bufferutil> node-gyp rebuild gyp ERR!配置错误gyp ERR! stack错误:找不到Python可执行文件“/path/to/executable/python2.7”,可以设置PYTHON env变量。 gyp ERR!在failNoPython堆栈(/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14)gyp ERR!堆栈在/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11 gyp ERR!堆栈在F(/usr/lib/node_modules/npm/node_modules/which/which.js:78:16)gyp ERR!堆栈在E(/usr/lib/node_modules/npm/node_modules/which/which.js:82:29)gyp ERR!堆栈在/usr/lib/node_modules/npm/node_modules/which/which.js:93:16 gyp ERR!堆栈在FSReqWrap.oncomplete(fs.js:82:15)gyp ERR! System Linux 3.13.0-74-generic gyp ERR!命令“/ usr / bin / nodejs”“/ usr / lib / node_modules / npm / node_modules / node -gyp / bin / node -gyp.js”“rebuild”gyp ERR! cwd /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/bufferutil gyp ERR! node -v v5.3.0 gyp ERR! node-gyp -v v3.2.1 gyp ERR!不行npm WARN安装:bufferutil@1.2.1 bufferutil@1.2.1安装:node-gyp rebuild npm WARN安装:bufferutil@1.2.1退出状态1> utf-8-validate@1.2.1 install /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/utf-8-validate> node-gyp rebuild gyp ERR!配置错误gyp ERR! stack错误:找不到Python可执行文件“/path/to/executable/python2.7”,可以设置PYTHON env变量。 gyp ERR!在failNoPython堆栈(/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14)gyp ERR!堆栈在/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11 gyp ERR!堆栈在F(/usr/lib/node_modules/npm/node_modules/which/which.js:78:16)gyp ERR!堆栈在E(/usr/lib/node_modules/npm/node_modules/which/which.js:82:29)gyp ERR!堆栈在/usr/lib/node_modules/npm/node_modules/which/which.js:93:16 gyp ERR!堆栈在FSReqWrap.oncomplete(fs.js:82:15)gyp ERR! System Linux 3.13.0-74-generic gyp ERR!命令“/ usr / bin / nodejs”“/ usr / lib / node_modules / npm / node_modules / node -gyp / bin / node -gyp.js”“rebuild”gyp ERR! cwd /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/utf-8-validate gyp ERR! node -v v5.3.0 gyp ERR! node-gyp -v v3.2.1 gyp ERR!不行npm WARN安装:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install:node-gyp rebuild npm WARN安装:utf-8-validate@1.2.1退出状态1

3 个答案:

答案 0 :(得分:22)

Scott Frees的解决方案对我不起作用,但正在运行

npm config set python $(which python)

确实

答案 1 :(得分:5)

如果您使用软件包管理器安装了Python,它应该已经在您的路径上 - 但如果不是:请像这样添加:

export PATH =“$ PATH:/ usr / local / bin / python(或者你安装python的地方)

Node-gyp需要2.x而且不能使用Python3(你是否安装了正确的版本?)。

请参阅Running Python on Windows for Node.js dependencies了解Windows以确保设置了环境变量。

答案 2 :(得分:0)

我通过将node-sass软件包升级到与已安装的Node版本兼容的版本来解决了类似的错误。

node-sass发布了我在其NPM页面上找到的兼容性表。