在shell_exec()中找不到节点和NPM命令

时间:2020-06-06 16:48:46

标签: node.js bash

NodeNPM命令在终端中正常运行,但在shell_exec()中不能正常运行。我尝试使用which Nodewhich NPM来获取它们的完整路径,然后使用该完整路径来运行命令。

/home/howtos67/bin/node -v 2>&1 //Return the correct version

/home/howtos67/bin/npm -v 2>&1 //No such file or directory

我错过了什么吗?如何解决此问题并像在终端机中一样通过shell_exec()运行命令?

更新:

这是返回的错误:

/usr/bin/env: node: No such file or directory

0 个答案:

没有答案