Failure on deploy: The command "/usr/bin/php /var/www/html/laravel-app/releases/1/artisan optimize" failed

Posted May 10, 2020 1.2k views

This is my first time with DigitalOcean and deploy. I am trying to deploy a fresh Laravel project to the “thainurses” droplet. If this works, I plan to permanently move my web sites to DigitalOcean. However it failed with one significant error. And I cannot find a solution after several hours.

Here is the full log

As we can see in the log, there is another minor error:
[] < chmod: missing operand

edited by MattIPv4

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there @rnond,

I’ve seen this with Laravel, there is actually a big discussion about this problem on the official Laravel GitHub repository here.

What you need to do is remove the closure from your API routes at routes/api.php.

If you are not using the API routes file,at the bottom of that routes/api.php file just comment these 3 lines:

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();

Hope that this helps!