Search code examples
laravelwindowsinstallation

Laravel Installer Error on Windows 11, PHP 8.2


I'm getting the following error while attempting to create a new project using the Laravel installer on Windows 11, PHP 8.2.

In the installer, I chose the No Starter Kit and Pest as a testing framework. As soon as I entered 0 to select the Pest framework, I got the following error:

PHP Fatal error:  Uncaught Error: Call to undefined function Laravel\Installer\Console\mb_rtrim() in C:\Users\newuser\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php:162
Stack trace:
#0 C:\Users\newuser\AppData\Roaming\Composer\vendor\symfony\console\Command\Command.php(279): Laravel\Installer\Console\NewCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 C:\Users\newuser\AppData\Roaming\Composer\vendor\symfony\console\Application.php(1029): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 C:\Users\newuser\AppData\Roaming\Composer\vendor\symfony\console\Application.php(316): Symfony\Component\Console\Application->doRunCommand(Object(Laravel\Installer\Console\NewCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 C:\Users\newuser\AppData\Roaming\Composer\vendor\symfony\console\Application.php(167): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 C:\Users\newuser\AppData\Roaming\Composer\vendor\laravel\installer\bin\laravel(13): Symfony\Component\Console\Application->run()
#5 C:\Users\newuser\AppData\Roaming\Composer\vendor\bin\laravel(119): include('C:\\Users\\newuse...')
#6 {main}
  thrown in C:\Users\newuser\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 162

Fatal error: Uncaught Error: Call to undefined function Laravel\Installer\Console\mb_rtrim() in C:\Users\newuser\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php:162
Stack trace:
#0 C:\Users\newuser\AppData\Roaming\Composer\vendor\symfony\console\Command\Command.php(279): Laravel\Installer\Console\NewCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 C:\Users\newuser\AppData\Roaming\Composer\vendor\symfony\console\Application.php(1029): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 C:\Users\newuser\AppData\Roaming\Composer\vendor\symfony\console\Application.php(316): Symfony\Component\Console\Application->doRunCommand(Object(Laravel\Installer\Console\NewCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 C:\Users\newuser\AppData\Roaming\Composer\vendor\symfony\console\Application.php(167): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 C:\Users\newuser\AppData\Roaming\Composer\vendor\laravel\installer\bin\laravel(13): Symfony\Component\Console\Application->run()
#5 C:\Users\newuser\AppData\Roaming\Composer\vendor\bin\laravel(119): include('C:\\Users\\newuse...')
#6 {main}
  thrown in C:\Users\newuser\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 162

Anyone facing similar issue with the installer?


Solution

  • It seems they introduced a change that uses a new function added on PHP 8.4. So if you don't want wait, you must either update to 8.4 or execute the following command:

    composer global require symfony/polyfill-mbstring