新建的webman項(xiàng)目,根據(jù)官方文檔,安裝數(shù)據(jù)庫(kù)擴(kuò)展報(bào)錯(cuò)
官方文檔:http://www.wtbis.cn/doc/webman/db/tutorial.html
// 創(chuàng)建Webman項(xiàng)目
composer create-project workerman/webman Test
// 進(jìn)入項(xiàng)目目錄
cd Test
// 安裝數(shù)據(jù)庫(kù)擴(kuò)展
composer require -W psr/container ^1.1.1 illuminate/database illuminate/pagination illuminate/events symfony/var-dumper
// 報(bào)錯(cuò)內(nèi)容
In PackageDiscoveryTrait.php line 361:
Could not find package windows.php.
Did you mean one of these?
skjob/wkhtmltopdf-windows
issetbv/push-notification
clevis/push-notifications
fishmad/wkhtmltopdf-windows
lifewatch/wkhtmltopdf-windows
require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>...]
電腦環(huán)境
安裝數(shù)據(jù)庫(kù)擴(kuò)展時(shí),如下去除 psr/container 的版本指定即可
composer require -W psr/container illuminate/database illuminate/pagination illuminate/events symfony/var-dumper
找了很久問題,發(fā)現(xiàn)在創(chuàng)建webman項(xiàng)目的時(shí)候,已經(jīng)安裝了 psr/container (2.0.2) ,而官方文檔里安裝數(shù)據(jù)庫(kù)擴(kuò)展命令里,還指定的psr/container 為1.1.1版本,所以嘗試 去除版本指定 就安裝成功了
composer create-project workerman/webman Test
Creating a "workerman/webman" project at "./Test"
Info from https://repo.packagist.org: #StandWithUkraine
Installing workerman/webman (v1.5.1)
- Installing workerman/webman (v1.5.1): Extracting archive
Created project in /Users/Jayden/Documents/Dev/SourceCode/PHP/laravel/Code/Webman/Test
Loading composer repositories with package information
Updating dependencies
Lock file operations: 6 installs, 0 updates, 0 removals
- Locking monolog/monolog (2.9.1)
- Locking nikic/fast-route (v1.3.0)
- Locking psr/container (2.0.2)
- Locking psr/log (3.0.0)
- Locking workerman/webman-framework (v1.5.4)
- Locking workerman/workerman (v4.1.9)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 6 installs, 0 updates, 0 removals
- Installing psr/log (3.0.0): Extracting archive
- Installing monolog/monolog (2.9.1): Extracting archive
- Installing workerman/workerman (v4.1.9): Extracting archive
- Installing psr/container (2.0.2): Extracting archive
- Installing nikic/fast-route (v1.3.0): Extracting archive
- Installing workerman/webman-framework (v1.5.4): Extracting archive
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
> support\Plugin::install
Create start.php
Create windows.php
Create support/bootstrap.php
Create support/helpers.php
14 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
可能是因?yàn)槲业碾娔X是PHP8,下載Laravel的組件都是最新V10版本,而 psr/container 1.1.1 最高只支持到 Laravel V9版本的原因,建議walkor 大佬可以把文檔中的^1.1.1去掉
---- 更新 ----
和walkor大佬討論了下,應(yīng)該不是Laravel V10版本的原因。具體原因不清楚。如果有遇到這個(gè)問題的人,可以嘗試下上面的解決方式
Could not find package windows.php.
composer require -W psr/container ^1.1.1
導(dǎo)致依賴 package windows.php
第一次見,猜測(cè)是你本地環(huán)境問題,不具有普遍性。
psr/container 1.1.1 支持最新的laravel 10數(shù)據(jù)庫(kù),目前看沒有去掉的必要。去掉的話會(huì)導(dǎo)致一些不支持 psr/container 2
的組件無(wú)法安裝,到時(shí)候會(huì)有更多的人發(fā)帖提問,我還是要改回去。psr/container ^1.1.1
的依賴就是之前很多人發(fā)帖反饋 psr/container 2
依賴問題才加進(jìn)去的。