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

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

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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! Regards, Bobby