Did you follow the upgrade procedure? Running composer update
won't be enough. laravel.com/docs/upgrade
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error (Laravel 4.1 upgrade)
-
27-06-2023 - |
Question
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"
]
},
Solution 2
OTHER TIPS
Maybe you can try this command:
composer install --no-scripts
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
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
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.
If using laravel 5 , then the correct file to delete is services.json
in bootstrap/cache
folder , this error is caused when composer is corrupt due to unfinished update ,
If none of the other answers work, please try this:
"pre-update-cmd": [],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],