skip to Main Content

I’m trying to create laravel project in WSL2 ubuntu. I have the projects folder (www) in the WSL root directory, inside that folder i have laravel_test subfolder. When i run

composer create-project laravel/laravel example-app

but i’m getting an error
Your requirements could not be resolved to an installable set of packages.
How can i slove this issue?

root@LAPTOP-R27NIA9B:~/www/laravel_test# composer create-project laravel/laravel example-app
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? Y
Creating a "laravel/laravel" project at "./example-app"
Installing laravel/laravel (v9.3.5)
  - Installing laravel/laravel (v9.3.5): Extracting archive
Created project in /root/www/laravel_test/example-app
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires laravel/pint ^1.0 -> satisfiable by laravel/pint[v1.0.0, v1.1.0, v1.1.1].
    - laravel/pint[v1.0.0, ..., v1.1.1] require ext-xml * -> it is missing from your system. Install or enable PHP's xml extension.
  Problem 2
    - phpunit/phpunit[9.5.10, ..., 9.5.x-dev] require ext-dom * -> it is missing from your system. Install or enable PHP's dom extension.
    - Root composer.json requires phpunit/phpunit ^9.5.10 -> satisfiable by phpunit/phpunit[9.5.10, ..., 9.5.x-dev].

To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/8.1/cli/php.ini
    - /etc/php/8.1/cli/conf.d/10-opcache.ini
    - /etc/php/8.1/cli/conf.d/10-pdo.ini
    - /etc/php/8.1/cli/conf.d/20-calendar.ini
    - /etc/php/8.1/cli/conf.d/20-ctype.ini
    - /etc/php/8.1/cli/conf.d/20-exif.ini
    - /etc/php/8.1/cli/conf.d/20-ffi.ini
    - /etc/php/8.1/cli/conf.d/20-fileinfo.ini
    - /etc/php/8.1/cli/conf.d/20-ftp.ini
    - /etc/php/8.1/cli/conf.d/20-gettext.ini
    - /etc/php/8.1/cli/conf.d/20-iconv.ini
    - /etc/php/8.1/cli/conf.d/20-phar.ini
    - /etc/php/8.1/cli/conf.d/20-posix.ini
    - /etc/php/8.1/cli/conf.d/20-readline.ini
    - /etc/php/8.1/cli/conf.d/20-shmop.ini
    - /etc/php/8.1/cli/conf.d/20-sockets.ini
    - /etc/php/8.1/cli/conf.d/20-sysvmsg.ini
    - /etc/php/8.1/cli/conf.d/20-sysvsem.ini
    - /etc/php/8.1/cli/conf.d/20-sysvshm.ini
    - /etc/php/8.1/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-xml --ignore-platform-req=ext-dom` to temporarily ignore these required extensions.

3

Answers


  1. you should just install ext-xml

    sudo apt-get install php-xml
    

    laravel/pint needs this package for running correctly

    Login or Signup to reply.
  2. my answer isn’t different from Farid Saravi answer , and it solved my problem too
    just want to add the answer for the second problem that appeared to me

    mentioning that i’m using linux ubuntu 22.04

    Problem 1

    • Root composer.json requires laravel/pint ^1.0 -> satisfiable by laravel/pint[v1.0.0, …, v1.2.0].
      – laravel/pint[v1.0.0, …, v1.2.0] require ext-xml * -> it is missing from your system. Install or enable PHP’s xml extension.

    and its answer

    sudo apt-get install php-xml
    

    Problem 2

    spatie/laravel-ignition[1.0.0, …, 1.6.1] require ext-curl * -> it is missing from your system. Install or enable PHP’s curl extension.
    – Root composer.json requires spatie/laravel-ignition ^1.0 -> satisfiable by spatie/laravel-ignition[1.0.0, …, 1.6.1].

    and its answer

    sudo apt-get install php-curl
    
    Login or Signup to reply.
  3. First, delete the project that gave error when creating. Then

    Run sudo apt-get install php8.2-curl

    you can change php.8.2-curl according to the PHP version you use.

    After this, create a project again. It will be successfully created

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search