按照webman手冊(cè)的描述安裝了blade模板引擎后,在安裝數(shù)據(jù)庫(kù)就報(bào)錯(cuò)了
composer require -W psr/container ^1.1.1 illuminate/database illuminate/pagination illuminate/events symfony/var-dumper
Using version ^9.40 for illuminate/database
Using version ^9.40 for illuminate/pagination
Using version ^9.40 for illuminate/events
Using version ^6.0 for symfony/var-dumper
./composer.json has been updated
Running composer update psr/container illuminate/database illuminate/pagination illuminate/events symfony/var-dumper --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- illuminate/view v8.83.26 requires illuminate/collections ^8.0 -> found illuminate/collections[v8.0.0, ..., v8.83.26] but it conflicts with another require.
- jenssegers/blade v1.4.0 requires illuminate/view ^5.5|^6.0|^7.0|^8.0 -> satisfiable by illuminate/view[v8.83.26].
- jenssegers/blade is locked to version v1.4.0 and an update of this package was not requested.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
這里寫具體的系統(tǒng)環(huán)境相關(guān)信息
win10
composer.json
{
"name": "workerman/webman",
"type": "project",
"keywords": [
"high performance",
"http service"
],
"homepage": "http://www.wtbis.cn",
"license": "MIT",
"description": "High performance HTTP Service Framework.",
"authors": [
{
"name": "walkor",
"email": "walkor@workerman.net",
"homepage": "http://www.wtbis.cn",
"role": "Developer"
}
],
"support": {
"email": "walkor@workerman.net",
"issues": "https://github.com/walkor/webman/issues",
"forum": "https://wenda.workerman.net/",
"wiki": "https://workerman.net/doc/webman",
"source": "https://github.com/walkor/webman"
},
"require": {
"php": ">=7.2",
"workerman/webman-framework": "^1.4.3",
"monolog/monolog": "^2.0",
"psr/container": "1.1.1",
"jenssegers/blade": "~1.4.0"
},
"suggest": {
"ext-event": "For better performance. "
},
"autoload": {
"psr-4": {
"": "./",
"App\\": "./app"
},
"files": [
"./support/helpers.php"
]
},
"scripts": {
"post-package-install": [
"support\\Plugin::install"
],
"post-package-update": [
"support\\Plugin::install"
],
"pre-package-uninstall": [
"support\\Plugin::uninstall"
]
}
}
先把blade模版卸載composer remove jenssegers/blade
,裝完數(shù)據(jù)庫(kù)再裝blade試下
我重新安裝了一次,這次先安裝的數(shù)據(jù)庫(kù),正常,然后安裝blade,報(bào)錯(cuò)了:
composer require psr/container ^1.1.1 jenssegers/blade:~1.4.0
提示:
./composer.json has been updated
Running composer update psr/container jenssegers/blade
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
illuminate/view[v5.5.0, ..., v5.5.44] require illuminate/container 5.5.* -> found illuminate/container[v5.5.0, ..., v5.5.44] but the package is fixed to v9.41.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
illuminate/view[v5.6.0, ..., v5.8.36] require php ^7.1.3 -> your php version (8.0.2) does not satisfy that requirement.
illuminate/view[v6.0.0, ..., v6.19.1] require php ^7.2 -> your php version (8.0.2) does not satisfy that requirement.
illuminate/view[v6.20.0, ..., v6.20.44] require illuminate/container ^6.0 -> found illuminate/container[v6.0.0, ..., v6.20.44] but the package is fixed to v9.41.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
illuminate/view[v7.0.0, ..., v7.28.4] require php ^7.2.5 -> your php version (8.0.2) does not satisfy that requirement.
illuminate/view[v7.29.0, ..., v7.30.6] require illuminate/container ^7.0 -> found illuminate/container[v7.0.0, ..., v7.30.6] but the package is fixed to v9.41.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
illuminate/view[v8.0.0, ..., v8.11.2] require php ^7.3 -> your php version (8.0.2) does not satisfy that requirement.
illuminate/view[v8.12.0, ..., v8.83.26] require illuminate/collections ^8.0 -> found illuminate/collections[v8.0.0, ..., v8.83.26] but the package is fixed to v9.41.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
jenssegers/blade v1.4.0 requires illuminate/view ^5.5|^6.0|^7.0|^8.0 -> satisfiable by illuminate/view[v5.5.0, ..., v5.8.36, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.26].
Root composer.json requires jenssegers/blade ~1.4.0 -> satisfiable by jenssegers/blade[v1.4.0].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
(wb2是項(xiàng)目文件名)用composer require webman/blade安裝之后,沒(méi)報(bào)錯(cuò)了,運(yùn)行出現(xiàn)了這個(gè)報(bào)錯(cuò)
Error: Call to undefined method Illuminate\Container\Container::terminating() in F:\2022www\webman\wb2\vendor\illuminate\view\ViewServiceProvider.php:26
Stack trace:
可能哪里不兼容,這個(gè)定位需要時(shí)間。
如果你php版本可以切換,可以用php7,php7下 Illuminate/database 和 jenssegers/blade 之間沒(méi)有沖突
都這么久了嗎?無(wú)意中看到了!
復(fù)用composer組件是正確的方向,否則每個(gè)框架都出一個(gè)自己的數(shù)據(jù)庫(kù) redis等各種輪子,即浪費(fèi)時(shí)間,又容易出bug,增加了php開(kāi)發(fā)者學(xué)習(xí)負(fù)擔(dān),對(duì)php社區(qū)也是一種割裂。
如果有個(gè)別composer組件有問(wèn)題,webman官方會(huì)fork一份自己維護(hù)。目前fork了一份webman/blade, 截圖中l(wèi)aravel-orm9 view不能同時(shí)安裝的問(wèn)題也解決了。
目前composer組件遇到的問(wèn)題基本上是依賴php版本低和其他組件的版本過(guò)低問(wèn)題,fork一份稍微修改下composer.json就解決了。