2014-01-09 215 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