php exec()返回127错误,其中在终端中运行的命令工作正常

I an trying to run this code in my server

exec("node -v", $out, $err);

echo "<pre>";
print_r($out);
print_r($err);

Its returning only 127.But npm, node js all installed in my server. Even if I trying to run node -v in my terminal its returning the version.

Please suggest what can be the issue for this.

Solved:

I have used this solution

exec("../../bin/node -v", $out, $err);