我在LINUX plcnext plc上使用node.js,但已经安装了另一个PYTHON版本。我确保在PATH和PYTHON变量中声明了它,并且还在pm中使用设置了它npm config set python。但是我收到同样的错误错误:找不到Python可执行文件。检查下面的所有代码
当我键入时,which python我得到正确的路径:
/home/root/.guix-profile/bin/python
结果echo $PYTHON:
/home/root/.guix-profile/bin
结果echo $PATH:
/home/root/.guix-profile/bin:/home/root/.guix-profile/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/bin:/opt/plcnext/appshome/data/60002172000051/bin:/opt/bin:/opt/sbin:/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/bin:/opt/plcnext/appshome/data/60002172000051/bin
我以前在npm中设置python的命令:
npm config set python /home/root/.guix-profile/bin
当我尝试命令“ npm install -g bcrypt”时,收到错误消息:
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@10.15.3 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "/home/root/.guix-profile/bin", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack at PythonFinder. (/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
解决方案
$ PYTHON变量需要是可执行文件或指向可执行文件的链接,而不是查找目录
PYTHON = / home / root / .guix-profile / bin / python