symfony2.1.7 composer install KnpPaginatorBundle

Posted

技术标签:

【中文标题】symfony2.1.7 composer install KnpPaginatorBundle【英文标题】: 【发布时间】:2014-01-09 15:07:14 【问题描述】:

当我运行 composer.phar 安装时,一切看起来都不错:

→ 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/KnpPaginatorBundle from https://packagist.org/packages/knplabs/knp-paginator-bundle

所以我用新的 require 行更新了 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.

还有我当前 composer.json 的 symfony2 行:

    "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

请问我该怎么办?

【问题讨论】:

【参考方案1】:

你应该在项目目录中运行这个命令:

php composer.phar update

【讨论】:

【参考方案2】:

几个小时后我终于找到了解决方案!

我不知道我的 composer.json 依赖项是否处于最佳状态,但解决我的问题的是仅更新和安装所需的包!

呜呜呜???我刚才说什么???是的,只有所需的捆绑包,所以...

sudo php composer.phar require 

然后,只需通过 https://packagist.org 的作曲家酷搜索找到您的愿望。

从列表中选择数字并填写版本。

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

希望这个答案对某人有所帮助!

【讨论】:

以上是关于symfony2.1.7 composer install KnpPaginatorBundle的主要内容,如果未能解决你的问题,请参考以下文章

Jetpack All In Compose ?看各种Jetpack库在Compose中的使用

error: version in "./docker-compose.yml" is unsupported

Composability and Recursion in snarkyJS

how to use composer in fiddler

[Javascript] Compose multiple functions for new behavior in JavaScript

What does ‘composer dump-autoload’ do in Laravel?