Yii2 |需要bower-asset / jquery

时间:2016-01-23 14:08:01

标签: yii2 composer-php

我试图通过作曲家安装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].

我做错了什么?

7 个答案:

答案 0 :(得分:39)

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

答案 1 :(得分:6)

您可以尝试较新的版本:

composer global require "fxp/composer-asset-plugin:^1.2.0"

然后:

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

未安装Bower-Asset方式:

您可以按Install from an Archive File下载Yii2。通过这种方式,你不会需要处理Bower问题。

此外,如果您需要在不处理Bower的情况下更新作曲家,则可以在yiisoft/yii2文件composer.json之前"require": { "php": ">=5.4.0", "yidas/yii2-composer-bower-skip": "~2.0.0", "yiisoft/yii2": "~2.0.5", "yiisoft/yii2-bootstrap": "~2.0.0" } 之前yidas/yii2-composer-bower-skip

composer create-project yidas/yii2-app-basic
  

相反,如果您想创建没有bower-asset问题的yii2项目:

     

yidas/yii2-app-basic

     

composer create-project yidas/yii2-app-advanced

     

yidas/yii2-app-advanced

     

fxp/composer-asset-plugin

  

从Yii 2.0.13起,它使用Asset-Packagist解决方案而不是split_df <- split(df, df$filename) subset_df <- do.call(rbind, lapply(split_df, function(x) {x[c("your_rows_here"),]}))

答案 2 :(得分:3)

此问题也可以通过

解决
composer require yidas/yii2-bower-asset

有关此套餐的更多详情:https://packagist.org/packages/yidas/yii2-bower-asset

答案 3 :(得分:1)

https://getcomposer.org/Composer-Setup.exe 下载并安装。安装后,在项目文件夹composer update

中运行此命令行

答案 4 :(得分:0)

首先更改.composer权限

sudo chown -R $USER .composer/

composer global require "fxp/composer-asset-plugin:^1.2.0"

答案 5 :(得分:0)

解决。需要先安装Composer Asset Plugin: php composer.phar global需要“fxp / composer-asset-plugin:1.0.0”

答案 6 :(得分:-1)

如果您需要jQuery 2.1版本。

composer global require "fxp/composer-asset-plugin:^1.4.0"
composer install

composer update