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

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

问题描述

我正在尝试使用 Laravel 进行一些开发,但由于某种原因,我无法让它安装任何依赖项中的 require-dev 部分中列出的任何包composer.json 文件.AFAIK,默认情况下应该安装开发依赖项.我已经在 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 self-update,所以应该是最新版本.运行 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 只安装列为require-dev"的包.您的主要 composer.json 文件,如果这些包确实需要其他东西,那么只有它们的需要"安装了软件包,但没有安装它们的require-dev".包.

Composer only ever installs the packages listed as "require-dev" of your main 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 contribute to an existing software 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天全站免登陆