Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii2 with composer and fxp/composer-asset-plugin

I'm working on a project using Yii2 PHP framework. Yii2 uses composer with fxp/composer-asset-plugin to handle project dependencies.

The problem is when a new developer comes to the project and runs

git clone <project-repo>
composer install

or another developer wants to install a new extension with composer require <package-name> often (very often) something goes wrong and composer (or maybe asset plugin, I mentioned above) shows another unclear error message (maybe only for me). And the developer spends lots of time to find what that error meant and how to deal with it.

Today I've cloned project on Windows machine, installed the latest composer and asset plugin versions, run composer install and, after about 20 minutes waiting, got this:

enter image description here

On my Linux system same dependencies have been installed without errors.

Question №1 What does this error mean and how can I fix it?

Question №2 Is it so bad idea to add vendor/ directory to version control? (I've read https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md)

Question №3 Maybe I'm doing something wrong or there is a secret, I'm not aware about, that allows to manage dependencies in Yii2 without such huge time loss.

Many thanks.

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"
        }
    }
}
like image 379
peresmeshnik Avatar asked Jul 31 '16 08:07

peresmeshnik


1 Answers

Try installing the dev-master of the asset-plugin

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

It solved a lot of problems on our end.

like image 109
Nikko Madrelijos Avatar answered Nov 03 '22 17:11

Nikko Madrelijos