[英]Error: Your requirements could not be resolved to an installable set of packages. Laravel
[英]PHP Laravel error - Your requirements could not be resolved to an installable set of packages
我正在嘗試在 WSL2 ubuntu 中創建 laravel 項目。我在 WSL 根目錄中有項目文件夾 (www),在該文件夾中我有 laravel_test 子文件夾。 當我跑
composer create-project laravel/laravel example-app
但我收到一個錯誤,您的要求無法解析為一組可安裝的軟件包。 我該如何解決這個問題?
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.
我的答案與 Farid Saravi 的答案沒有什么不同,它也解決了我的問題只是想為我出現的第二個問題添加答案
- Root composer.json 需要 laravel/pint ^1.0 -> 可由 laravel/pint [v1.0.0, ..., v1.2.0] 滿足。 - laravel/pint[v1.0.0, ..., v1.2.0] 需要 ext-xml * -> 你的系統中缺少它。 安裝或啟用 PHP 的 xml 擴展。
及其答案
sudo apt-get install php-xml
spatie/laravel-ignition[1.0.0, ..., 1.6.1] 需要 ext-curl * -> 您的系統中缺少它。 安裝或啟用 PHP 的 curl 擴展。 - Root composer.json 需要 spatie/laravel-ignition ^1.0 -> 可由 spatie/laravel-ignition[1.0.0, ..., 1.6.1] 滿足。
及其答案
sudo apt-get install php-curl
你應該只安裝 ext-xml
sudo apt-get install php-xml
laravel/pint 需要這個 package 才能正常運行
首先,刪除創建時出錯的項目。 然后
運行sudo apt-get install php8.2-curl
您可以根據您使用的PHP版本更改php.8.2-curl。
在此之后,再次創建一個項目。 就會創建成功
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.