yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

Composer new asset manager error #5107

Closed johnluxor closed 10 years ago

johnluxor commented 10 years ago

Today, I decided execute composer update command, but get that errors

 [Composer\DependencyResolver\SolverProblemsException]                                                                          
    Problem 1                                                                                                                    
      - Installation request for yiisoft/yii2 * -> satisfiable by yiisoft/yii2[dev-master].                                      
      - yiisoft/yii2 dev-master requires bower-asset/jquery 1.11.* | 2.1.* -> no matching package found.                         
    Problem 2                                                                                                                    
      - Installation request for yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[dev-master].                  
      - yiisoft/yii2-bootstrap dev-master requires bower-asset/bootstrap 3.2.* -> no matching package found.                     
    Problem 3                                                                                                                    
      - Installation request for yiisoft/yii2-jui * -> satisfiable by yiisoft/yii2-jui[dev-master].                              
      - yiisoft/yii2-jui dev-master requires bower-asset/jquery-ui 1.11.* -> no matching package found.    
githubjeka commented 10 years ago

https://github.com/yiisoft/yii2/issues/5083#issuecomment-56132945

francoispluchino commented 10 years ago

Strange behavior, it is caused by the dependencies in the require-dev section. Move the dependencies in require and the solver arrives to solve the version correctly ...

gimox commented 10 years ago

same problem, but not solved...

francoispluchino commented 10 years ago

@gimox see #5083

gimox commented 10 years ago

the jquery problem came back....

The file or directory to be published does not exist: /var/www/html/app/vendor/bower/jquery/dist

gimox commented 10 years ago

solved adding "bower-asset/jquery": "@stable", jquery versin not stable hasn't "dist directory"

for a strange way...if i have some extension in require-dev, composer fail...

gimox commented 10 years ago

the bower bootstrap download the dev package it has many error in less now to solve it add in composer.json "bower-asset/bootstrap":"@stable".

githubjeka commented 10 years ago

It is temporarily. Do not rush to be updated.

cebe commented 10 years ago

@johnluxor please show your composer.json

johnluxor commented 10 years ago
{
  "name": "sample/self",
  "description": "sample",
  "minimum-stability": "dev",
  "require": {
    "php": ">=5.4.0",
    "yiisoft/yii2": "*",
    "yiisoft/yii2-bootstrap": "*",
    "yiisoft/yii2-swiftmailer": "*",
    "asofter/yii2-imperavi-redactor": "*",
    "yiisoft/yii2-imagine": "*",
    "2amigos/yii2-grid-view-library": "*",
    "2amigos/yii2-file-upload-widget": "*",
    "2amigos/yii2-date-time-picker-widget": "*",
    "2amigos/yii2-file-input-widget": "*",
    "2amigos/yii2-bootstrap-form-helpers-library": "*",
    "creocoder/yii2-nested-set-behavior": "*",
    "yiisoft/yii2-jui": "*",
    "2amigos/yii2-disqus-widget": "*",
  },
  "require-dev": {
    "yiisoft/yii2-codeception": "*",
    "yiisoft/yii2-debug": "*",
    "yiisoft/yii2-gii": "*"
  },
  "scripts": {
    "post-create-project-cmd": [
      "yii\\composer\\Installer::setPermission"
    ]
  },
  "config": {
    "process-timeout": 1800
  },
  "extra": {
    "writable": [
      "runtime",
      "web/media",
      "web/assets"
    ],
    "executable": [
      "yii"
    ],
    "asset-installer-paths": {
      "npm-asset-library": "vendor/npm",
      "bower-asset-library": "vendor/bower"
    }
  }
}

When I added

    "bower-asset/jquery": "@stable",
    "bower-asset/bootstrap": "@stable",
    "bower-asset/jquery-ui": "@stable",
    "bower-asset/jquery.inputmask": "@stable",
    "bower-asset/punycode": "@stable"

it solved my problem

akaNightmare commented 10 years ago

@johnluxor does not work

t-tomek commented 10 years ago

@johnluxor worked for me :+1:

francoispluchino commented 10 years ago

If you want to use the stable versions for assets, you must add the flag "@ stable" for each asset package, because the package root has a "minimum-stability" option on "dev".

Shybko commented 10 years ago

@johnluxor worked for me too :)

andrewblake1 commented 10 years ago

@johnluxor worked for me too, cheers

ptheofan commented 10 years ago

I had the same problem, like could no longer use composer as project would just collapse!

switched composer asset plugin to 1.0.0-beta1 php composer.phar global require "fxp/composer-asset-plugin:1.0.0-beta1"

and then composer update works. However the new issue was that the bower assets folder is now called bower-asset instead of bower.

So, I created an alias in the common/config/aliases.php (advanced template) Yii::setAlias('@bower', dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'vendor/bower-asset');

and (unfortunately) had to edit a line in the Yii2 codebase vendor/yiisoft/yii2/base/Application.php @ 452 (just commented it out).

When this is officially fixed (of if there's some other way to override the @bower alias) we can just uncomment the line.

Hope this helps.

francoispluchino commented 10 years ago

@ptheofan This change is doing in the config of composer.json file of Yii2 (see Define a custom directory for the assets installation for edit manually the config).

francoispluchino commented 10 years ago

A solution has been found (see francoispluchino/composer-asset-plugin#29).

Now the alias of a branch is added if:

cebe commented 10 years ago

Thanks @francoispluchino !

cebe commented 10 years ago

I have also added the @stable tag to the application composer.json: 8176a392bb31f3fe0003a5bfc9e08866a86cdd38

zqtsx commented 10 years ago

...

mdmunir commented 10 years ago

:(

  [Composer\DependencyResolver\SolverProblemsException]                                                              
    Problem 1                                                                                                        
      - yiisoft/yii2 dev-master requires bower-asset/jquery 2.1.*@stable | ~2.1@stable | ~1.11@stable -> no matching package found.                                                                                                   
      - yiisoft/yii2 2.0.x-dev requires bower-asset/jquery 2.1.*@stable | ~2.1@stable | ~1.11@stable -> no matchingpackage found.                                                                                                    
      - Installation request for yiisoft/yii2 * -> satisfiable by yiisoft/yii2[2.0.x-dev, dev-master].               
  Potential causes:                                                                                                  
   - A typo in the package name                                                                                      
   - The package is not available in a stable-enough version according to your minimum-stability setting             
     see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.                   
  Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.                         
githubjeka commented 10 years ago

@MDMunir https://github.com/yiisoft/yii2/issues/5083#issuecomment-56773213

mdmunir commented 10 years ago

@githubjeka do you mean this?

php composer.phar global require "fxp/composer-asset-plugin:1.0.0-beta1"

what the diferent with "fxp/composer-asset-plugin:1.0.*@dev"?

should i run it again?

githubjeka commented 10 years ago

https://github.com/yiisoft/yii2/issues/5083#issuecomment-56150406 https://github.com/yiisoft/yii2/issues/5083#issuecomment-56164524 ....

Read guide - https://github.com/yiisoft/yii2/tree/master/apps/basic#install-via-composer

mdmunir commented 10 years ago

@githubjeka It work, thanks. Just change to beta.

francoispluchino commented 10 years ago

@MDMunir have you this error with the most recent version ("dev") installed in global mode?

mdmunir commented 10 years ago

@francoispluchino ya, i got that error. I should specify version of package to be work. eg bower-asset/jquery 2.1.1.

it is your component, right? good job, i like it :+1:

francoispluchino commented 10 years ago

@MDMunir Can you give me your composer.json file, that I fixes this problem, please?

mdmunir commented 10 years ago
{
    "name": "sangkil/sangkilbiz3",
    "description": "Simple ERP",
    "keywords": ["yii2", "ERP"],
    "homepage": "http://www.sangkilsoft.com/",
    "type": "project",
    "license": "BSD-3-Clause",
    "authors": [
        {
            "name": "Mujib Masyhudi",
            "email": "mujib.masyhudi@gmail.com",
            "homepage": "http://www.sangkilsoft.com/",
            "role": "Founder and project lead"
        },
        {
            "name": "Misbahul Munir",
            "email": "misbahuldmunir@gmail.com",
            "role": "Core project development"
        }
    ],
    "support": {
        "issues": "https://github.com/sangkil/sangkilbiz3/issues?page=1&state=open",
        "source": "https://github.com/sangkil/sangkilbiz3"
    },
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": "*",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-jui": "*",
        "mdmsoft/yii2-admin": "*",
        "mdmsoft/yii2-autonumber": "*",
        "mdmsoft/yii2-logger": "*",
        "mdmsoft/yii2-format-converter": "*",
        "mdmsoft/yii2-client-tools": "*",
        "mdmsoft/yii2-ar-behaviors": "*",
        "mdmsoft/yii2-widgets": "*"
    },
    "require-dev": {
        "yiisoft/yii2-codeception": "*",
        "yiisoft/yii2-debug": "*",
        "yiisoft/yii2-gii": "*"
    },
    "suggest": {
        "codeception/codeception": "Codeception, 1.8.*@dev is currently works well with Yii.",
        "codeception/specify": "BDD style code blocks for PHPUnit and Codeception",
        "codeception/verify": "BDD Assertions for PHPUnit and Codeception",
        "yiisoft/yii2-faker": "Fixtures generator for Yii2 based on Faker lib",
        "yiisoft/yii2-mongodb": "Use for transaction logging"
    },
    "config": {
        "process-timeout": 1800
    },
    "extra": {
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    }
}

mdmsoft/* has no required bower

francoispluchino commented 10 years ago

@MDMunir I just tested, and everything is OK. I think your Composer does not use the latest version dev of my plugin (and also Composer).

Commands executed:

$ composer selfupdate
$ composer global require fxp/composer-asset-plugin:@dev

You can also update your global dependencies:

$ composer global update

And I get:

$ composer install --prefer-dist
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing yiisoft/yii2-composer (dev-master 0128e4a)
    Downloading: 100%
    Extracting archive

  - Installing bower-asset/jquery (2.1.1)
    Downloading: 100%
    Extracting archive

  - Installing bower-asset/yii2-pjax (v2.0.0)
    Downloading: 100%
    Extracting archive

  - Installing bower-asset/punycode (v1.3.1)
    Downloading: 100%
    Extracting archive

  - Installing bower-asset/jquery.inputmask (3.x-dev 836b4e5)
    Downloading: 100%
    Extracting archive

  - Installing cebe/markdown (0.9.x-dev 6a3c373)
    Downloading: 100%
    Extracting archive

  - Installing ezyang/htmlpurifier (v4.6.0)
    Downloading: 100%
    Extracting archive

  - Installing yiisoft/yii2 (dev-master af7ee57)
    Downloading: 100%
    Extracting archive

  - Installing phpspec/php-diff (dev-master 30e103d)
    Downloading: 100%
    Extracting archive

  - Installing mdmsoft/yii2-autonumber (dev-master d357c7a)
    Downloading: 100%
    Extracting archive

  - Installing mdmsoft/yii2-logger (dev-master e307c74)
    Downloading: 100%
    Extracting archive

  - Installing mdmsoft/yii2-format-converter (dev-master 9db2719)
    Downloading: 100%
    Extracting archive

  - Installing mdmsoft/yii2-client-tools (dev-master 7abb733)
    Downloading: 100%
    Extracting archive

  - Installing mdmsoft/yii2-ar-behaviors (dev-master dac5a4c)
    Downloading: 100%
    Extracting archive

  - Installing mdmsoft/yii2-widgets (dev-master d2b8a18)
    Downloading: 100%
    Extracting archive

  - Installing bower-asset/jquery-ui (1.11.1)
    Downloading: 100%
    Extracting archive

  - Installing yiisoft/yii2-jui (dev-master b6ec81d)
    Downloading: 100%
    Extracting archive

  - Installing mdmsoft/yii2-admin (dev-master 61dcf6c)
    Downloading: 100%
    Extracting archive

  - Installing yiisoft/yii2-codeception (dev-master 2f7a70f)
    Downloading: 100%
    Extracting archive

  - Installing bower-asset/bootstrap (v3.2.0)
    Downloading: 100%
    Extracting archive

  - Installing yiisoft/yii2-bootstrap (dev-master f295f15)
    Downloading: 100%
    Extracting archive

  - Installing yiisoft/yii2-debug (dev-master ae57c50)
    Downloading: 100%
    Extracting archive

  - Installing bower-asset/typeahead.js (v0.10.5)
    Downloading: 100%
    Extracting archive

  - Installing yiisoft/yii2-gii (dev-master 7858501)
    Downloading: 100%
    Extracting archive

mdmsoft/yii2-logger suggests installing yiisoft/yii2-mongodb (Use for mongo storage)
Writing lock file
Generating autoload files
mdmunir commented 10 years ago

@francoispluchino Sory, may be its my fault. I run

php composer.phar global require "fxp/composer-asset-plugin:1.0.*@dev"

more than week ago. I dont see @dev here, so i dont have initiative to update it :grinning: . I will update it to dev again. thanks.

he11d0g commented 8 years ago

@francoispluchino Thx ;)