Yii2与composer和fxp / composer-asset-plugin

时间:2016-07-31 08:13:41

标签: yii2 composer-php

我正在使用Yii2 PHP框架开展项目。 Yii2使用 composer fxp / composer-asset-plugin 来处理项目依赖关系。

问题在于新开发人员进入项目并运行

git clone <project-repo>
composer install

或其他开发者希望安装composer require <package-name>的新扩展程序经常(经常)出现问题并且作曲家(或者资源插件,我提到过上面)显示另一个不明确的错误消息(可能仅对我而言)。开发人员花了很多时间来查找错误的含义以及如何处理错误。

今天我在Windows机器上克隆了项目,安装了最新的作曲家资产插件版本,运行composer install,等待约20分钟后,得到了这个:

enter image description here

在我的Linux系统上安装了相同的依赖项而没有错误。

问题№1 这个错误意味着什么,我该如何解决?

问题№2vendor/目录添加到版本控制是否是一个糟糕的主意? (我读过https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md

问题№3 也许我做错了什么或有一个秘密,我不知道,它允许在没有如此巨大的时间损失的情况下管理Yii2中的依赖。

非常感谢。

composer.json

{
    "name": "yiisoft/yii2-app-basic",
    "description": "Yii 2 Basic Project Template",
    "keywords": ["yii2", "framework", "basic", "project template"],
    "homepage": "http://www.yiiframework.com/",
    "type": "project",
    "license": "BSD-3-Clause",
    "support": {
        "issues": "https://github.com/yiisoft/yii2/issues?state=open",
        "forum": "http://www.yiiframework.com/forum/",
        "wiki": "http://www.yiiframework.com/wiki/",
        "irc": "irc://irc.freenode.net/yii",
        "source": "https://github.com/yiisoft/yii2"
    },
    "repositories": [
        {
            "type": "git",
            "url":  "https://github.com/ZeroVision/swiftmailer.git"
        }
    ],
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.4.0",
        "giggsey/libphonenumber-for-php": "~7.0",
        "yiisoft/yii2": "2.0.7",
        "swiftmailer/swiftmailer": "dev-fixStreamBufferTransport",
        "yiisoft/yii2-bootstrap": ">=2.0.3",
        "yiisoft/yii2-swiftmailer": "*",
        "yiisoft/yii2-authclient": "^2.0@dev",
        "2amigos/yii2-date-picker-widget": "~1.0",
        "kartik-v/yii2-widget-timepicker": "*",
        "kartik-v/yii2-widget-rating": "*",
        "2amigos/yii2-gallery-widget": "~1.0",
        "2amigos/yii2-ckeditor-widget": "~1.0",
        "uran1980/yii2-scroll-to-top": "dev-master",
        "yii-cms/yii2-robokassa": "^1.1",
        "onokumus/metismenu": "v2.4.2",
        "rmrevin/yii2-fontawesome": "*",
        "dektrium/yii2-user": "*",
        "p2made/yii2-sb-admin-theme": "1.1.2",
        "p2made/yii2-p2y2-things": "*",
        "p2made/yii2-asset-collection": "*",
        "demi/image": "~1.0",
        "demi/cropper": "~1.0",
        "cyneek/yii2-widget-upload-crop": "dev-master",
        "Nemmo/yii2-attachments": "*",
        "2amigos/yii2-file-input-widget": "*",
        "rkit/yii2-ajaxform-plugin": "^0.0.4",
        "nsept/yii2-birthday-picker": "*",
        "bryglen/yii2-apns-gcm": "1.0.4"
    },
    "require-dev": {
        "yiisoft/yii2-codeception": "*",
        "yiisoft/yii2-debug": "*",
        "yiisoft/yii2-gii": "*",
        "yiisoft/yii2-faker": "*"
    },
    "config": {
        "process-timeout": 1800
    },
    "scripts": {
        "post-create-project-cmd": [
            "yii\\composer\\Installer::postCreateProject"
        ]
    },
    "extra": {
        "yii\\composer\\Installer::postCreateProject": {
            "setPermission": [
                {
                    "runtime": "0777",
                    "web/assets": "0777",
                    "yii": "0755"
                }
            ],
            "generateCookieValidationKey": [
                "config/web.php"
            ]
        },
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    }
}

1 个答案:

答案 0 :(得分:9)

尝试安装asset-plugin的dev-master

composer global require "fxp/composer-asset-plugin:dev-master"

它解决了很多问题。