Error when running `vendor:publish` in laravel
rambhosale opened this issue · 3 comments
rambhosale commented
When running vendor:publish
in Laravel following error is thrown
Which provider or tag's files would you like to publish?
Error
Call to undefined function Termwind\ValueObjects\mb_strimwidth()
at vendor/nunomaduro/termwind/src/ValueObjects/Styles.php:1053
1049▕ */
1050▕ private static function trimText(string $text, int $width): string
1051▕ {
1052▕ preg_match_all(self::STYLING_REGEX, $text, $matches, PREG_OFFSET_CAPTURE);
➜ 1053▕ $text = rtrim(mb_strimwidth(preg_replace(self::STYLING_REGEX, '', $text) ?? '', 0, $width, '', 'UTF-8'));
1054▕
1055▕ foreach ($matches[0] ?? [] as [$part, $index]) {
1056▕ $text = substr($text, 0, $index).$part.substr($text, $index, null);
1057▕ }
+4 vendor frames
5 [internal]:0
Termwind\Components\Element::__toString()
+32 vendor frames
38 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
nunomaduro commented
Laravel requires the mbstring extension to be installed.
IgorDePaula commented
I got in this time this error, laravel not notice abount this extension, I believe that termwind can be have.
martijngastkemper commented
Laravel does require the mbstring extension, but that requirement can be solved with symfony/polyfill-mbstring. But not completely, because that polyfill doesn't contain every function. The readme file says it's a partial implementation. And mb_strimwidth
(https://github.com/symfony/polyfill-mbstring/blob/e5e7ddb00b859dbdf5ad8f3bbe4cd29a3a37aa34/Mbstring.php#L62) is one of the not implemented functions.