简体   繁体   中英

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

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

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

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.

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.

要解决它,您需要安装更新版本的 php 8.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM