Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

raffelustig's avatar

Error after change from 5.3 to 5.4 laravel

I just changed 5.3 to 5.4 in composer.json and did a composer update. Getting this:

40 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Script php artisan optimize handling the post-update-cmd event returned with error code 255

What is causing that?

0 likes
42 replies
Sinnbeck's avatar

I dont remember what post-update-cmd runs in such an old version. Check the script that is being called in composer.json

Sinnbeck's avatar

@raffelustig no clue why that fails. Try temporarily removing the command and finish upgrading. Then add it back in and see if you can do composer update

"post-install-cmd": [
            "Illuminate\Foundation\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
raffelustig's avatar

Ok, there is two of them, had to delete both and after that no errors from composer update. What does it tells us? I'm not an expert in Laravel and we have done a laravel shift from 5.3 to 5.4 but ar not getting any further. So what next?

raffelustig's avatar

I put them back and did a new composer update now getting this:

28 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize

                                                           
  [Symfony\Component\Debug\Exception\FatalThrowableError]  
  Class 'Laravel\Tinker\TinkerServiceProvider' not found   
                                                           

Script php artisan optimize handling the post-update-cmd event returned with error code 1
Ralphs-MacBook:webshooter_web ralph$ 
raffelustig's avatar

Wow, that was something else. Thank you very much. Now I will try to get it up and running.

Asaad Belkahia's avatar

Hello, i think you need to check the compatibility :

v1.0.0 requires

php: >=5.5.9 illuminate/console: ~5.1 illuminate/contracts: ~5.1 illuminate/support: ~5.1 psy/psysh: 0.7.|0.8. symfony/var-dumper: ~3.0

requires (dev)

phpunit/phpunit: ~4.0|~5.0 suggests

illuminate/database: The Illuminate Database package (~5.1).

raffelustig's avatar

Will look into that as I got errors when trying to startup:

------                                                                                                    
 > [webshooter_web_webapp-aws internal] load build context:                                               
------                                                                                                    
------                                                                                                    
 > [webshooter_web_webapp stage-0  9/16] RUN npm install -g yarn:                                         
#26 15.86 npm WARN npm npm does not support Node.js v10.24.0
#26 15.91 npm WARN npm You should probably upgrade to a newer version of node as we
#26 15.91 npm WARN npm can't make any promises that npm will work with this version.
#26 15.91 npm WARN npm You can find the latest version at https://nodejs.org/
#26 15.94 npm ERR! Unexpected token =
#26 16.02 
#26 16.02 npm ERR! A complete log of this run can be found in:
#26 16.02 npm ERR!     /root/.npm/_logs/2021-11-30T19_47_00_321Z-debug.log
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c npm install -g yarn]: exit code: 1
Ralphs-MacBook:webshooter_web ralph$ 

raffelustig's avatar

@Sinnbeck The system is sitting in a docker environment and there is several commands to get it up and running. Such as this:

if [ ! -f ".dont_install" ]; then

echo Install started

composer install  --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader

cp .env.docker .env
php artisan passport:install
php artisan key:generate
php vendor/bin/optimus spark|grep :|sed -e 's/\(.*\)/\U/' -e 's/: /=/' -e 's/^/OPTIMUS_/' >> .env

npm install && gulp
php artisan config:clear
php artisan migrate
php artisan db:seed
#php artisan passport:install|grep t:|awk '/t:/ { getline; sub(/.*:.* /,"API_CLIENT_SECRET="); print LARACASTS_SNIPPET_PLACEHOLDER;}' >> .env
php artisan passport:client --password|grep t:|awk '/t:/ { getline; sub(/.*:.* /,"API_CLIENT_SECRET="); print LARACASTS_SNIPPET_PLACEHOLDER;}' >> .env

mkdir -p storage/app/public
mkdir -p storage/framework/cache
mkdir -p storage/framework/sessions
mkdir -p storage/framework/views
mkdir -p storage/logs

chmod 777 -R storage

chown www-data:www-data -R storage
chmod 600 storage/oauth-*.key

touch .dont_install

echo Install completed

fi

echo Starting php-fpm

php-fpm -F -R

Sinnbeck's avatar

@raffelustig ok. Let us know once your docker issues are fixed so we can get back to updating laravel :)

raffelustig's avatar

@Sinnbeck As I think I said earlier I ordered a Laravel Docker Shift for $49 with no success yet. I have the 5.4 to 5.5 waiting also if I succeed with this.

Sinnbeck's avatar

@raffelustig no the issue seems to be with the docker image trying to install yarn and failing. I assume it's another docker image that you posted as the failing command is RUN npm install -g yarn

raffelustig's avatar

@Sinnbeck If I do this:

Ralphs-MacBook:webshooter_web ralph$ 
Ralphs-MacBook:webshooter_web ralph$ npm install -g yarn

changed 1 package, and audited 2 packages in 2s

found 0 vulnerabilities
Ralphs-MacBook:webshooter_web ralph$ 

it works

raffelustig's avatar
Ralphs-MacBook:webshooter_web ralph$ node -v
v17.1.0
Ralphs-MacBook:webshooter_web ralph$ npm -v
8.1.4
Sinnbeck's avatar

@raffelustig then I assume you are getting the error building your images. I assume you run something like docker-compose up

Sinnbeck's avatar

@raffelustig image file. Not image as such. Perhaps create a new thread regarding your docker images not working. As you can see from the error, the problem is with npm, and not php/laravel

raffelustig's avatar

@Sinnbeck I have these:

redis		alpine	3900abf41552	about 8 hours ago	32.38 MB	
nginx		alpine	b46db85084b8	17 days ago	23.2 MB	
maildev/maildev		latest	9259e42215ab	over 1 year ago	86.62 MB	
mysql		5.7.22	6bb891430fb6	over 3 years ago	371.94 MB

Can't see any yarn anywhere

Sinnbeck's avatar

@raffelustig those are running containers. Your problem is building an image which can then run as a container

1 like
Sinnbeck's avatar

@raffelustig well still the issue is building the image.

The number here shows what layer it is building of the image (layer 9 out of 16)

9/16] RUN npm install -g yarn
raffelustig's avatar

It talkes about a log

#26 16.02 npm ERR! A complete log of this run can be found in:
#26 16.02 npm ERR!     /root/.npm/_logs/2021-11-30T19_47_00_321Z-debug.log

I can not find that anywhere

raffelustig's avatar

@Sinnbeck Now I can not do anything. I changed over to my master branch and it complains about yarn also. So now it's something in npm or node versions.

jlrdw's avatar

@raffelustig have you considered a new version and migrate models, controllers, etc over to a new install.

raffelustig's avatar

@jlrdw Do you have a suggestion on how and in what order I shall copy the different parts over to the new, empty laravel? I'm not sure I have done it in proper order. And how to test during?

jlrdw's avatar

@raffelustig see here https://laravel.com/docs/8.x/upgrade

But read each upgrade guide for every version.

Whether or not you are upgrading or migrating stuff over the upgrade guides shows you the changes that you need to be aware of.

One time I went from a 5.5 to 6.1, only took about 30 minutes. And that was migrating stuff to a new application not an upgrade.

Scoobie's avatar

@raffelustig What would do for copy/migrate strategy is make a git branch with the LTS version of Laravel cleanly installed to it, a branch of your master with edited areas like app directory resources etc, and then I would merge to force a conflict. The conflict will flag all your goodies. And then you can work it in methodically. It really does sound like a pain but not as bad as upgrading from each version until 9x LTS.

The easiest thing to do just copy and paste the logic into a clean laravel install and then upgrade php or SQL where necessary. Newer versions of Laravel are recommended to Jetstream, which I agree, but I think UI is better for this.

Also, you got docker. They say its good for legacy apps because you can run older versions of ubuntu

raffelustig's avatar

I have put this problem in the trash can. I'm now concentrating on Laravel 8 version.

raffelustig's avatar
raffelustig
OP
Best Answer
Level 2

Now the system is successfully upgraded to Laravel 9.11.0

Please or to participate in this conversation.