I am trying to build an angular project from a Laravel project.
When I run an exec command from Laravel I got env: node: No such file or directory
Steps to reproduce :
- create Laravel project:
laravel new laravel-bug
- create angular project:
ng new angular-bug
In the Laravel file routes/web.php, in the / route, add:
use Symfony\Component\Process\Process;
$process = new Process('cd /path/to/angular-bug && ng build');
$process->run(function ($type, $buffer) {
if (Process::ERR === $type) {
echo 'ERR > '.$buffer;
} else {
echo 'OUT > '.$buffer;
}
});
This will output the result, which for me is env: node: No such file or directory
Any ideas ?