2014-01-09 185 views
2

当我运行composer.phar安装一切看上去不错:symfony2.1.7作曲家安装KnpPaginatorBundle

→ sudo php composer.phar install 

Loading composer repositories with package information 
Installing dependencies (including require-dev) from lock file 
Nothing to install or update 
Generating autoload files 
Clearing the cache for the dev environment with debug true 
Installing assets using the hard copy option 
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework 
Installing assets for FOS\JsRoutingBundle into web/bundles/fosjsrouting 
etc etc 

但现在,我想安装这个套件:https://github.com/KnpLabs/KnpPaginatorBundlehttps://packagist.org/packages/knplabs/knp-paginator-bundle

所以我更新composer.json文件与新的需求线。

{ 
"require": { 
    "knplabs/knp-paginator-bundle": "v2.1" 
} 

}

(我曾经尝试分页程序从packegist和每一个版本仍然是相同的错误)

然后我尝试安装它:和

→ sudo php composer.phar install 
Loading composer repositories with package information 
Installing dependencies (including require-dev) from lock file 
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them. 
Your requirements could not be resolved to an installable set of packages. 

    Problem 1 
    - Installation request for symfony/framework-standard-edition 2.1.x-dev -> satisfiable by symfony/framework-standard-edition[2.1.x-dev]. 
    - symfony/framework-standard-edition 2.1.x-dev requires knplabs/knp-paginator-bundle v2.1 -> no matching package found. 

Potential causes: 
- A typo in the package name 
- The package is not available in a stable-enough version according to your minimum-stability setting 
    see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details. 

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. 

的Symfony2的线我目前的composer.json:

"require": { 
    "php": ">=5.3.3", 
    "symfony/symfony": "2.1.*", 
    "doctrine/orm": ">=2.2.3,<2.4-dev", 

"symfony/symfony": "2.1.x-dev" did not help 

我该怎么做?

回答

0

几个小时后,我终于找到了解决办法!

我不知道我的composer.json依赖关系是不是最好的形状,但解决我的问题是更新和安装只需要捆绑!

woooot ???我刚才说了些什么?是的,只有所需的包等等......

sudo php composer.phar require 

然后刚从https://packagist.org找到你的欲望由作曲家酷搜索捆绑。

从列表中选择号码并填写版本。

它会下载捆绑, 更新composer.json和composer.lock文件:)

希望这个答案可以帮助别人!

2

你应该在项目目录运行此命令:

php composer.phar update