8

I'm trying to do a composer install in a Laravel project cloned from git.

But im getting some errors.

The first one that I solved was:

- phpunit/phpunit[8.5.0, ..., 8.5.x-dev] require ext-dom * -> it is missing from your system. Install or enable PHP's dom extension.

By doing:

sudo apt install php7-4-xml php7.4-mbstring

But now when I do a composer update or composer install I’m getting this answer:

PHP Fatal error: Uncaught Error: Class 'Normalizer' not found in /usr/share/php/Symfony/Component/Console/Helper/Helper.php:129.

Stack trace:

#0 /usr/share/php/Symfony/Component/Console/Helper/ProgressBar.php(516): Symfony\Component\Console\Helper\Helper::strlenWithoutDecoration()
#1 /usr/share/php/Symfony/Component/Console/Helper/ProgressBar.php(576): Symfony\Component\Console\Helper\ProgressBar::Symfony\Component\Console\Helper\{closure}()
#2 [internal function]: Symfony\Component\Console\Helper\ProgressBar->Symfony\Component\Console\Helper\{closure}()
#3 /usr/share/php/Symfony/Component/Console/Helper/ProgressBar.php(589): preg_replace_callback()
#4 /usr/share/php/Symfony/Component/Console/Helper/ProgressBar.php(414): Symfony\Component\Console\Helper\ProgressBar->buildLine()
#5 /usr/share/php/Symfony/Component/Console/Helper/ProgressBar.php(323): Symfony\Component\Console\Helper\ProgressBar->display()
#6 /usr/share/php/Composer/Util/Loop.php(85): Symfony\Component\Console\Helper\ProgressBar->start()
#7 /usr/share/php/Compos in /usr/share/php/Symfony/Component/Console/Helper/Helper.php on line 129

Fatal error: Uncaught Error: Class 'Normalizer' not found in /usr/share/php/Symfony/Component/Console/Helper/Helper.php:129
Stack trace:
#0 /usr/share/php/Symfony/Component/Console/Helper/ProgressBar.php(516): Symfony\Component\Console\Helper\Helper::strlenWithoutDecoration()
#1 /usr/share/php/Symfony/Component/Console/Helper/ProgressBar.php(576): Symfony\Component\Console\Helper\ProgressBar::Symfony\Component\Console\Helper\{closure}()
#2 [internal function]: Symfony\Component\Console\Helper\ProgressBar->Symfony\Component\Console\Helper\{closure}()
#3 /usr/share/php/Symfony/Component/Console/Helper/ProgressBar.php(589): preg_replace_callback()
#4 /usr/share/php/Symfony/Component/Console/Helper/ProgressBar.php(414): Symfony\Component\Console\Helper\ProgressBar->buildLine()
#5 /usr/share/php/Symfony/Component/Console/Helper/ProgressBar.php(323): Symfony\Component\Console\Helper\ProgressBar->display()
#6 /usr/share/php/Composer/Util/Loop.php(85): Symfony\Component\Console\Helper\ProgressBar->start()
#7 /usr/share/php/Compos in /usr/share/php/Symfony/Component/Console/Helper/Helper.php on line 129
  • see (https://stackoverflow.com/questions/8597146/class-normalizer-not-found-in-php-5-3-8#:~:text=Left%2Dclick%20on%20the%20WAMP,fine%20while%20it%20doesn't. )if this helps – Deepak Feb 21 '22 at 16:39
  • Does this answer your question? [Class Normalizer not found (in PHP 5.3.8)](https://stackoverflow.com/questions/8597146/class-normalizer-not-found-in-php-5-3-8) – Deepak Feb 21 '22 at 18:00
  • Please share more details. Which version of Symfony do you use? Searching through some versions, I could not find the code that triggers this problem. – Nico Haase Feb 22 '22 at 07:58
  • When I run the "Composer" command, I get the same error. I can tell you the version of Composer, which is installed. But symfony I have been unable to find the version. The version of Composer is 2.0.9. – Paco Cayuela Sanchez Feb 23 '22 at 15:15
  • 1
    Why not update that version? It's more than a year old, and maybe that's a bug that has been fixed? – Nico Haase Feb 23 '22 at 15:23
  • Also, as your code seems to run in `/usr/share/php`: how did it get there? Did you install Symfony over your system's package manager? – Nico Haase Feb 23 '22 at 15:26
  • Sorry for the absence and the delay. Finally, due to others problems with the OS I've decided to reinstall the OS. I was able to install the project without any problem after that. – Paco Cayuela Sanchez Mar 01 '22 at 15:14

5 Answers5

29

It requires php-intl to be installed

Normalizer class comes with the php internationalization extension (php-intl). It must be installed for using the Normalizer class

on debian i did

sudo apt install php-intl

It should fix the problem

Sivadas Rajan
  • 578
  • 5
  • 9
3

Firstly you can try to install php-intl package

sudo apt install php-intl

If it doesn't help, you can run following commands one by one to upgrade php version to 8.1. (for Debian based OS):

sudo apt update
sudo apt upgrade
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt install php8.1 php8.1-cli php8.1-fpm php8.1-apcu php8.1-opcache php8.1-common php8.1-curl php8.1-zip php8.1-mcrypt php8.1-mysql php8.1-mbstring php8.1-xml php8.1-gd php8.1-imagick php8.1-xmlrpc php8.1-maxminddb
sudo update-alternatives --set php /usr/bin/php8.1

Then check php version:

php --version

This helped me to fix error.

Jeyhun Rashidov
  • 181
  • 3
  • 14
1

To solve it you need to install newer version of php 8.1

  • 1
    Please add some explanation to your answer such that others can learn from it. From my POV, nothing in the question indicates that PHP 8.1 would magically solve the problem – Nico Haase Jul 12 '22 at 12:28
0

I had this issue and managed to fix it by uninstalling composer, then reinstalling composer correctly from the right repositories. I was using sudo-apt get composer, which was the issue.

dennisdup
  • 77
  • 4
0

This could be fixed by installing Composer directly from their website.

Remove the one installed with the package manager of your OS, then run:

curl -sS https://getcomposer.org/installer | php && sudo mv composer.phar /usr/local/bin/composer

arieltools
  • 1,136
  • 3
  • 15
  • 21