Composer不会安装“ require-dev”包装 [英] Composer won't install "require-dev" packages

查看:638
本文介绍了Composer不会安装“ require-dev”包装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Laravel进行开发,由于某种原因,我无法安装 require-dev 部分中列出的任何软件包。在任何依赖项的 composer.json 文件中。 AFAIK,默认情况下应该安装dev依赖项。我已经尝试过在 composer install 上使用和不使用-dev 标志的情况。我也尝试过删除 vendors / 的内容,并删除 composer.lock 〜 /.composer 并从头开始重新安装所有依赖项,但还是没有运气。我还尝试了 composer update 命令的各种迭代。

I'm trying to do some development with Laravel, and for some reason I can't get it to install any of the packages listed in the require-dev section in any of the dependencies' composer.json files. AFAIK, dev dependencies are supposed to be installed by default. I've tried it with and without the --dev flag on composer install. I've also tried removing the contents of vendors/ and deleting composer.lock and ~/.composer and reinstalling all the dependencies from scratch, but still no luck. I've also tried various iterations of the composer update command.

例如,在 vendor / laravel / framework / composer.json ,它列出了这些内容:

For example, in vendor/laravel/framework/composer.json, it lists these:

"require-dev": {
    "aws/aws-sdk-php": "2.4.*",
    "iron-io/iron_mq": "1.4.*",
    "pda/pheanstalk": "2.1.*",
    "mockery/mockery": "0.8.0",
    "phpunit/phpunit": "3.7.*"
},

这些都没有安装。有什么想法我想念的吗?这是我的主要 composer.json 文件FWIW。

None of these are getting installed. Any ideas what am I missing? Here's my main composer.json file, FWIW.

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
    "laravel/framework": "4.0.*",
    "rncryptor/rncryptor-php": "1.*"
},
"autoload": {
    "classmap": [
        "app/commands",
        "app/controllers",
        "app/models",
        "app/libraries",
        "app/database/migrations",
        "app/database/seeds",
        "app/tests/TestCase.php"
    ]
},
"scripts": {
    "post-install-cmd": [
        "php artisan optimize"
    ],
    "pre-update-cmd": [
        "php artisan clear-compiled"
    ],
    "post-update-cmd": [
        "php artisan optimize"
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ]
},
"config": {
    "preferred-install": "dist"
},
"minimum-stability": "dev"
}

我运行了编写器自我更新,因此它应该是最新版本。运行 composer --version 显示以下内容:

I ran composer self-update, so it should be the latest version. Running composer --version shows this:

Composer version b20021cc6aa113069e4223b78d0074a1fc7dd4e8 2014-01-14 16:22:09


推荐答案

仅作曲家安装主composer.json文件中列为 require-dev的软件包,如果这些软件包确实需要其他东西,则仅安装其 require软件包,而不安装其 require-dev软件包。

Composer only ever installs the packages listed as "require-dev" of your master composer.json file, and if these packages do need something else, then only their "require" packages are installed, but not their "require-dev" packages.

这实际上是一件好事。如果您要开发软件包,请克隆其存储库,安装开发所需的一切,并随时可以提供帮助。但是,如果您需要自己的软件使用该软件包,则开发特定软件包不是用例,而是开发您自己的软件的用例。

This actually is a good thing. If you want to develop a package, you'd clone their repository, install everything needed for development, and are ready to contribute. But if you require that package for your own software, this is no use case to develop that particular package - it is the use case to develop your own software.

因此tl; dr:Composer仅安装composer.json的开发要求,而不安装任何依赖项。

So the tl;dr: Composer only installs the development requirements of the composer.json, not of any dependencies.

这篇关于Composer不会安装“ require-dev”包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆