我尝试过安装yii2 2-引导4,但是我得到了这个作曲家错误
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for yiisoft/yii2-bootstrap4 ^1.0@dev -> satisfiable by yiisoft/yii2-bootstrap4[1.0.x-dev].
- Conclusion: don't install bower-asset/bootstrap v3.3.7
- yiisoft/yii2-bootstrap4 1.0.x-dev requires bower-asset/bootstrap ~4.0.0 -> satisfiable by bower-asset/bootstrap[v4.0.0, v4.0.0-beta.3, v4.0.0-beta1, v4.0.0-alpha.6, v4.0.0-alpha.5, v4.0.0-alpha.4, v4.0.0-alpha.3, v4.0.0-alpha.2, v4.0.0-alpha1].
- Can only install one of: bower-asset/bootstrap[v3.3.7, v4.0.0].
- Can only install one of: bower-asset/bootstrap[v3.3.7, v4.0.0-beta.3].
- Can only install one of: bower-asset/bootstrap[v3.3.7, v4.0.0-beta1].
- Can only install one of: bower-asset/bootstrap[v3.3.7, v4.0.0-alpha.6].
- Can only install one of: bower-asset/bootstrap[v3.3.7, v4.0.0-alpha.5].
- Can only install one of: bower-asset/bootstrap[v3.3.7, v4.0.0-alpha.4].
- Can only install one of: bower-asset/bootstrap[v3.3.7, v4.0.0-alpha.3].
- Can only install one of: bower-asset/bootstrap[v3.3.7, v4.0.0-alpha.2].
- Can only install one of: bower-asset/bootstrap[v3.3.7, v4.0.0-alpha1].
- Installation request for bower-asset/bootstrap (locked at v3.3.7) -> satisfiable by bower-asset/bootstrap[v3.3.7].
Installation failed, reverting ./composer.json to its original content我希望能够在同一个应用程序中使用bootstrap3和4,我也尝试了在这个问题 "prefer-stable": true,中描述的内容,但是也没有工作。那么,我应该做什么呢,如何同时使用引导程序:~3.0和引导程序:~4.0与官方的yii2 2-引导包
发布于 2018-10-18 15:15:35
很多关于如何在Yii2中使用引导带4的解决方案。甚至Yii2团队也为此创建了一个扩展。但既然,我不喜欢太多的配置。我就是这么做的。在AppAsset.php中,使用自定义的自定义删除yii\bootstrap\BootstrapAsset。我建议你坚持原来的文件名和类名。
// AppAsset.php
public $depends = [
'yii\web\YiiAsset',
//'yii\bootstrap\BootstrapAsset', // Remove this
'app\assets\BootstrapAsset', // Add this
];然后,我在资产文件夹中创建了一个BootstrapAsset.php文件。从yii\bootstrap\BootstrapAsset复制代码。然后更改了代码的某些部分。没有国家预防机制,没有鲍尔。
namespace app\assets;
use yii\web\AssetBundle;
class BootstrapAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'vendor/bootstrap/css/bootstrap.min.css'
];
public $js = [
'vendor/bootstrap/js/bootstrap.min.js',
'vendor/popper.js/umd/popper.min.js'
];
}发布于 2018-04-25 19:04:20
您可以尝试以这种方式覆盖某些需求:
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "~2.0.14",
"yiisoft/yii2-bootstrap": "~2.0.8",
"yiisoft/yii2-bootstrap4": "1.0.x-dev",
"bower-asset/bootstrap": "3.3.7 as 4.1.3",
"npm-asset/bootstrap": "~4.1.3"
},这将从bower安装引导3.3.7,从npm安装引导4.1.3。您需要更新bootstrap4资产包的路径:
'components' => [
'assetManager' => [
'bundles' => [
'yii\bootstrap4\BootstrapAsset' => [
'sourcePath' => '@npm/bootstrap/dist'
],
'yii\bootstrap4\BootstrapPluginAsset' => [
'sourcePath' => '@npm/bootstrap/dist'
]
]
]
]请注意,yii2-bootstrap4还没有准备好使用,甚至没有alpha/beta版本,因此还需要考虑许多其他问题。
https://stackoverflow.com/questions/50028312
复制相似问题