Script php artisan clear-compiled handling the pre-update-cmd event returned with an error (Laravel 4.1 upgrade)
Solution 1
Did you follow the upgrade procedure? Running composer update
won't be enough. laravel.com/docs/upgrade
Solution 2
Maybe you can try this command:
composer install --no-scripts
Solution 3
Try to remove /bootstrap/compiled.php (I was in trouble downgrading Laravel 4.2 > 4.1)
Then try to composer update
, it should work.
Good luck
Solution 4
Worked for me:
After updating composer.jsonper the upgrade guide, to get all updated repo's:
composer update --no-scripts
Then: composer dump-autoload -o
Then, I ran an update again so my pre/post update scripts can run: composer update
App loads in browser and all my tests pass again using 5.2. Hope this helps.
Solution 5
Try the following in your composer.json. There clear-compiled handling the pre-update-cmd event is your error you might clear it.
"scripts": {
"pre-install-cmd": [
"php artisan clear-compiled"
],
"post-install-cmd": [
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
]
},
Try to run again the following command:
php composer.phar update
Related videos on Youtube
user1072337
Updated on July 09, 2022Comments
-
user1072337 almost 2 years
I recently tried upgrading from Laravel 4.0 to Laravel 4.1, and I am getting the follow error when running php composer.phar update:
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error [RuntimeException] Error Output: update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]
I am only requiring:
"require": { "laravel/framework": "4.1.*", "way/generators": "2.*", "madewithlove/laravel-oauth2": "0.4.*" },
Also, I received this before the error (even though I am running php 5.4.10 in my environment):
phpseclib/phpseclib suggests installing ext-gmp (Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.) phpseclib/phpseclib suggests installing pear-pear/PHP_Compat (Install PHP_Compat to get phpseclib working on PHP < 4.3.3.) d11wtq/boris suggests installing ext-readline (*) d11wtq/boris suggests installing ext-pcntl (*) Writing lock file Generating autoload files
EDIT:
Scripts being used in composer.json:
"scripts": { "pre-install-cmd": [ "php artisan clear-compiled" ], "post-install-cmd": [ "php artisan optimize" ], "pre-update-cmd": [ "php artisan clear-compiled" ], "post-update-cmd": [ "php artisan optimize" ], "post-create-project-cmd": [ "php artisan key:generate" ] },
-
user2094178 about 10 yearsDid you follow the upgrade procedure? Running
composer update
won't be enough. laravel.com/docs/upgrade -
user1072337 about 10 yearsmaking the aforementioned changes in the upgrade fixed the problem. Thank you. If you would like to answer, I will give you the checkmark.
-
user2094178 about 10 yearsOk, I'll answer, thank you.
-
Nanhe Kumar almost 10 yearsif you are using ubuntu then sudo php5enmod mcrypt
-
-
user1072337 about 10 yearsAfter making this change (see edit above), I am still receiving the error: Script php artisan clear-compiled handling the pre-update-cmd event returned with an error [RuntimeException] Error Output:
-
Bmoeller almost 10 yearsI'll give a point for sending me in the right direction. I updated from 4.0 - 4.1 and never looked for update notes. Encountered the same issue as the poster and followed the update directions. Ran the update again and it worked.
-
Kryten almost 10 yearsJust an added note for anyone who might find this later --- the order of changes is important! The upgrade procedure calls for running
composer update
after changes are made. I was trying to run it first and running into this problem. -
Rich Bradshaw almost 10 years@Kryten what should I do if I did composer update before making changes?
-
Kryten almost 10 years@RichBradshaw I just went ahead ignored the errors, made the rest of the changes suggested in the upgrade instructions, then ran
composer update
at the end. It worked fine. -
ρяσѕρєя K over 7 yearsThis post isn't an actual attempt at answering the question. Please note StackOverflow doesn't work like a discussion forum, it is a Q&A site where every post is either a question or an answer to a question. Posts can also have comments - small sentences like this one - that can be used to critique or request clarification from an author. This should be either a comment or a new question
-
KhoPhi over 5 yearsExcept this was the actual solution that helped in my case.
-
andromeda over 5 yearsWorked for me in Laravel 5.2
-
Rostyslav Pylypenko almost 5 yearsFrom 5.5 migration. "With recent improvements to PHP op-code caching, the optimize Artisan command is no longer needed. You should remove any references to this command from your deployment scripts as it will be removed in a future release of Laravel."