Node
和NPM
命令在终端中正常运行,但在shell_exec()
中不能正常运行。我尝试使用which Node
和which 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