Script php artisan clear-compiled handling the pre-update-cmd event returned with an error

June 22, 2013

I had a problem with Basset package (website didn’t load, it kept timing out) so I tried to remove it from the composer.json file to see if it helps. After running php composer.phar update I got this error:

Script php artisan clear-compiled handling the pre-update-cmd event returned with an error

You can even get this error:

Script php artisan optimize handling the post-update-cmd event returned with an error

To fix this error open your composer.json file and delete the scripts key (or just the part that fails – in bold). In my case it was this:

	"scripts": {
		"pre-update-cmd": [
			"php artisan clear-compiled"
		],
		"post-install-cmd": [
			"php artisan optimize"
		],
		"post-update-cmd": [
			"php artisan optimize"
		]
	},

I ran php composer.phar update again and it worked.

Some people report that after this they have problems with running php artisan optimize and few others . I didn’t have this problem but if you have it then delete the app/bootstrap/compiled.php file and then try running php composer.phar update

Share this page:Share on RedditDigg thisShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on StumbleUponShare on TumblrBuffer this pageEmail this to someone

5 comments

  1. Jorge Suarez - July 26, 2013 3:50 pm

    First:
    $ composer.phar update –no-scripts

    Later:
    $ composer.phar update

    And It worked. I believe this way is much better.

    Reply
    • El Coderino - August 3, 2013 7:57 pm

      Thanks for the tip. Yes,it is faster but I think in this case we bypass the execution of all scripts.

      Reply
      • The Brain - December 14, 2013 12:59 am

        Thank you sir!

        Reply
    • The Brain - December 14, 2013 12:58 am

      Works great, thnx

      Reply
  2. nico - September 5, 2014 9:08 pm

    Delete the custom helper files you added or make sure there are no errors in them.
    “files”: [“app/helpers.php”
    ],

    Nothing else worked for me.

    Reply

Have your say