PowerBI CLI node: no such file or directory

I am trying to create a PHP wrapper for PowerBI . I installed PowerBI Cli ( https://github.com/Microsoft/PowerBI-Cli ) on my local computer, and when I run any PowerBI Cli command on my terminal, it works fine. It works well even when I run commands using user _www ( sudo -u _www powerbi config )

However, when I run them through PHP using shell_exec or the Symphony Process Component ( https://symfony.com/doc/current/components/process.html ), I got the following exception:

 env: node: No such file or directory. 

I ran into this problem on Mac Sierra . Commands work well on Linux using PHP exec()

+5
source share
2 answers

Try the link ,

 "ln -s /path/where/command/is stored/ /to/path/where u want to exec/" 

Sometimes a program is stored in usr/local/bin/program , meanwhile by default you run in usr/bin/program

And then in the shell use the new path that you set.

Example for a link, suppose if you have a path to a command,

/usr/bin/powerbi , then using the command above you can bind the new path usr/powerbi , after which you can use the new path in the exec or shell command.

+2
source

Try using the full path, not the command. Not knowing your exact path, I can’t say exactly what to do, but it will be something like this:

 $output = shell_exec("sudo -u _www /path/path/powerbi config"); var_dump($output); 

Edit:

Or change directories first. Therefore, using my example above, this will be:

 $output = shell_exec("cd /path/path/powerbi; sudo -u _www powerbi config"); 
+1
source

Source: https://habr.com/ru/post/1262087/


All Articles