“找不到Python可执行文件...” - npm安装挂起 [英] "Can't find Python executable..." - npm install hangs

查看:319
本文介绍了“找不到Python可执行文件...” - npm安装挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用npm install来下载并编译我已经写过的一个小的node.js应用程序的所有依赖项。我使用的package.json文件是正确的,并且包含所有需要的信息。

I am using "npm install" to download and compile all the dependencies of a small node.js app I have written. The "package.json" file I am using is correct and contains all the needed information.

要安装的一个软件包中有一个node-gyp作为依赖,所以我以前安装了python2软件包。

One of the packages to be installed has "node-gyp" as a dependency, so I have previously installed the "python2" package.

现在,在某一点我开始收到错误消息:

Now, at a certain point I start getting error messages:

> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:103:14)
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:42:11
gyp ERR! stack     at F (/usr/lib/node_modules/npm/node_modules/which/which.js:40:25)
gyp ERR! stack     at E (/usr/lib/node_modules/npm/node_modules/which/which.js:43:29)
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/which.js:54:16
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:99:15)
gyp ERR! System Linux 3.18.9-200.fc21.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /srv/visitor/node_modules/phantom/node_modules/dnode/node_modules/weak
gyp ERR! node -v v0.12.1
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing weak@0.3.4

问题似乎是一个环境变量丢失。

The issues seems to be that an environment variable is missing.

任何人都可以指向正确的方向吗?无论我在互联网上搜索的地方,还没有提到PYTHON变量,只有PYTHONPATH和其他人喜欢。解决这个问题的正确方法是什么?为什么我不会收到这些错误?

Can anyone point me in the right direction? No matter where I search on the Internet, there is no mention of a "PYTHON" variable, only "PYTHONPATH" and others like it. What is the correct way to fix this, so that I do not get those errors?

更新1:

在执行npm安装之后,我从以下线程中添加了这些命令:

After following advice from this thread I added these commands before executing "npm install":

PYTHON=/usr/sbin/python2
export PYTHON

现在我得到这个错误: / p>

Now I am getting this error:

> node-gyp rebuild

gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack     at F (/usr/lib/node_modules/npm/node_modules/which/which.js:40:28)
gyp ERR! stack     at E (/usr/lib/node_modules/npm/node_modules/which/which.js:43:29)
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/which.js:54:16
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:99:15)
gyp ERR! System Linux 3.18.9-200.fc21.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /srv/visitor/node_modules/phantom/node_modules/dnode/node_modules/weak
gyp ERR! node -v v0.12.1
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing weak@0.3.4

我发现荒谬的说,没有找到:做...。有可能是这样吗?如果是,如何安装包正确?

I find it absurd that it says "...not found: make...". Is there any possibility of it being so? If yes, how come packages install correctly?

坦白说,我不明白一件事情。任何想法?

Frankly, I do not understand a thing. Any ideas?

推荐答案

第一件事:我要感谢所有投入到帮助我的问题,特别是@ adarsh。

First things first: I want to thank all who pitched in to help me with my issue, and especially @adarsh.

现在真正的问题是我错过了make和gcc。起初,当一个编译器的消息建议如此,我发现它荒谬。但请记住,这是从Docker注册表中提取的图像。

Now the real issue was that I was missing "make" and "gcc". At first, when a compiler message suggested so, I found it absurd. But keep in mind that this is an image PULLed from the Docker registry.

我在Docker文件中添加了pacman -S - needed --noconfirm make gcc,构建过程成功完成。

I added "pacman -S --needed --noconfirm make gcc" in my Dockerfile, and the build process completes successfully.

不用说,我也需要对环境变量做出建议的修改。

It should go without saying, that I also needed to make the suggested changes to the environmental variables.

这篇关于“找不到Python可执行文件...” - npm安装挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆