我正在尝试通过作曲家安装 Yii2:
composer global require "fxp/composer-asset-plugin:~1.1.1"
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
~/.composer/composer.json
{
"require": {
"fxp/composer-asset-plugin": "~1.1.1"
}
}
结果:
Problem 1
- yiisoft/yii2 2.0.x-dev requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
- yiisoft/yii2 dev-master requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
- yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
- yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
- Installation request for yiisoft/yii2 >=2.0.5 -> satisfiable by yiisoft/yii2[2.0.5, 2.0.6, dev-master, 2.0.x-dev].
我做错了什么?
rm -rf ~/.composer/vendor
rm ~/.composer/composer.lock
cd ~/.composer
composer clear-cache
composer self-update
composer global require "fxp/composer-asset-plugin:^1.1.3"
composer install
然后转到工作目录并运行:
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
您可以尝试较新的版本:
composer global require "fxp/composer-asset-plugin:^1.2.0"
然后:
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
非安装鲍尔资产方式:
您可以通过从存档文件安装来下载 Yii2。这样,您无需处理鲍尔问题。
此外,如果您需要在不处理 Bower 的情况下更新作曲家,您可以在composer.json
文件中yiisoft/yii2
之前要求 yidas/yii2-composer-bower-skip:
"require": {
"php": ">=5.4.0",
"yidas/yii2-composer-bower-skip": "~2.0.0",
"yiisoft/yii2": "~2.0.5",
"yiisoft/yii2-bootstrap": "~2.0.0"
}
相反,如果你想在没有bower-assets问题的情况下创建yii2项目:
yidas/yii2-app-basic:
composer create-project yidas/yii2-app-basic
Yidas/yii2-app-advanced:
composer create-project yidas/yii2-app-advanced
从 Yii 2.0.13 开始,它使用了 Asset-Packagist 解决方案而不是
fxp/composer-asset-plugin
这个问题也可以通过以下方式解决
composer require yidas/yii2-bower-asset
有关此软件包的更多详细信息:https://packagist.org/packages/yidas/yii2-bower-asset
https://getcomposer.org/Composer-Setup.exe下载并安装。安装后,在项目文件夹中运行此命令行composer update
已解决。我需要先安装作曲家资源插件:
php composer.phar global require "fxp/composer-asset-plugin:1.0.0"
首先更改 .composer 权限
sudo chown -R $USER .composer/
然后
composer global require "fxp/composer-asset-plugin:^1.2.0"