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:RedditDiggFacebookGoogle+TwitterLinkedInStumbleUpontumblrbufferEmail
  • Jorge Suarez

    First:
    $ composer.phar update –no-scripts

    Later:
    $ composer.phar update

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

    • El Coderino

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

      • The Brain

        Thank you sir!

    • The Brain

      Works great, thnx

  • nico

    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.