如何解决composer.json中所需的4.1安装和4.0依赖包之间的Laravel版本冲突

时间:2014-01-10 20:53:50

标签: php laravel composer-php

我正在尝试安装laravelodbc软件包以与laravel框架一起使用。我最初使用composer create-project laravel/laravel --prefer-dist安装了laravel。然后我将"jtgrimes/laravelodbc": "0.2.*"添加到我的composer.json文件中,并将'jtgrimes\Laravelodbc\ODBCServiceProvider'添加到a​​pp.php中的提供程序列表中。

require文件中的composer.json键如下:

"require": {
  "laravel/framework": "4.1.*",
  "yajra/laravel-oci8": "*",
  "jtgrimes/laravelodbc": "*"
},

当我尝试按laravelodbc readme中的建议运行composer update时。

Your requirements could not be resolved to an installable set of packages, the following message is given:

  Problem 1
    - Conclusion: remove laravel/framework 4.1.x-dev
    - Conclusion: don't install laravel/framework 4.1.x-dev
    - Conclusion: don't install laravel/framework v4.1.13
    - Conclusion: don't install laravel/framework v4.1.12
    - Conclusion: don't install laravel/framework v4.1.11
    - Conclusion: don't install laravel/framework v4.1.10
    - Conclusion: don't install laravel/framework v4.1.9
    - Conclusion: don't install laravel/framework v4.1.8
    - Conclusion: don't install laravel/framework v4.1.7
    - Conclusion: don't install laravel/framework v4.1.6
    - Conclusion: don't install laravel/framework v4.1.5
    - Conclusion: don't install laravel/framework v4.1.4
    - Conclusion: don't install laravel/framework v4.1.3
    - Conclusion: don't install laravel/framework v4.1.2
    - Conclusion: don't install laravel/framework v4.1.1
    - jtgrimes/laravelodbc 0.1.1 requires illuminate/database 4.0.x -> satisfiable by laravel/framework[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9], illuminate/database[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9].
    - jtgrimes/laravelodbc 0.1.2 requires illuminate/database 4.0.x -> satisfiable by laravel/framework[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9], illuminate/database[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9].
    - jtgrimes/laravelodbc 0.1.3 requires illuminate/database 4.0.x -> satisfiable by laravel/framework[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9], illuminate/database[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9].
    - jtgrimes/laravelodbc 0.1.4 requires illuminate/database 4.0.x -> satisfiable by laravel/framework[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9], illuminate/database[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9].
    - jtgrimes/laravelodbc 0.2.0 requires illuminate/database 4.0.x -> satisfiable by laravel/framework[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9], illuminate/database[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9].
    - jtgrimes/laravelodbc dev-master requires illuminate/database 4.0.x -> satisfiable by laravel/framework[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9], illuminate/database[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9].
    - Can only install one of: laravel/framework[v4.1.0, 4.0.x-dev].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.0].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.0-BETA2].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.0-BETA3].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.0-BETA4].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.1].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.10].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.2].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.3].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.4].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.5].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.6].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.7].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.8].
    - Can only install one of: laravel/framework[v4.1.0, v4.0.9].
    - don't install illuminate/database 4.0.x-dev|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.0|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.0-BETA2|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.0-BETA3|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.0-BETA4|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.1|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.10|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.2|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.3|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.4|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.5|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.6|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.7|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.8|don't install laravel/framework v4.1.0
    - don't install illuminate/database v4.0.9|don't install laravel/framework v4.1.0
    - Installation request for laravel/framework 4.1.* -> satisfiable by laravel/framework[4.1.x-dev, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.13, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9].
    - Installation request for jtgrimes/laravelodbc * -> satisfiable by jtgrimes/laravelodbc[0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.2.0, dev-master].

修改 我正在尝试使用不同版本的laravel,看看是否能解决我的问题并忘记在发布问题时将其更改回来。现在,上面显示了正确版本的laravel,并显示了如上所示的相同结果消息。

编辑2 我尝试了你的建议,我的fork是here(注意那里对composer.json文件的更改)。我还更改了laravel项目中的composer.json文件:

"require": {
  "laravel/framework": "4.1.*",
  "yajra/laravel-oci8": "*",
  "Purkinje/laravelodbc": "*"
},

...

"repositories": [
        {
                "type": "vcs",
                "url": "https://github.com/Purkinje/laravelodbc"
        }
],

当我运行composer update时,我收到错误:

Problem 1
    - The requested package purkinje/laravelodbc could not be found in any version, there may be a typo in the package name.

1 个答案:

答案 0 :(得分:1)

如果您使用的是Laravel 4.1(作为安装命令的结果,您根据实际的4.1版本实例化了一个项目),您可能会遇到一些版本冲突 - 因为4.1大约只有一个月左右。

请注意你在“jtgrimes / laravelodbc”包中的composer.json文件

 "illuminate/support": "4.0.x",
                "illuminate/database": "4.0.x"
    },

所以这是一个obvoius版本冲突,因为你安装了4.1。

快速解决方法是只创建一个基于Laravel 4.0的新项目,这样您就可以轻松安装所有软件包,而无需在Github上分叉它们

composer create-project laravel/laravel --prefer-dist your_project_name 4.0

另一个修复方法是在github上分割项目,更改composer.json文件以包含4.1版本,然后通过添加对git repo的引用来指向你的作曲家从分叉版本安装:

repositories": [
   {
     "type": "git",
     "url": "git://github.com/your-github-username/yourfork.git"
   }
]

请记住,4.0-> 4.1更改确实意味着某些Laravel功能的使用发生了一些变化,因此在某些情况下,当提升到4.1使用时,程序包可能无法按预期(或根本不)工作。有关详细信息,请参阅laravel.com/docs/upgrade。