Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer dependency problem #13247

Closed
inacho opened this issue Dec 19, 2016 · 27 comments
Closed

Composer dependency problem #13247

inacho opened this issue Dec 19, 2016 · 27 comments

Comments

@inacho
Copy link

inacho commented Dec 19, 2016

I can't execute composer update or composer install because Yii2 depends on "bower-asset/jquery", which not longer exists (https://github.com/bower-asset/jquery)

Any solution?
Thanks

Wokraround: #13247 (comment)

@nadar
Copy link
Contributor

nadar commented Dec 19, 2016

fxpio/composer-asset-plugin#268

After removing my Composer caches, I confirm that the problem comes from Packagist. Composer downloads a list of repository providers in COMPOSER_HOME/repo/https---packagist.org/provider-bower-asset$jquery.json (for jquery).

The problem comes with the virtual packages referenced by many packages with provide and replace section.

@http403
Copy link

http403 commented Dec 19, 2016

bower-asset is totally down, no repo inside
Prove

@SilverFire
Copy link
Member

SilverFire commented Dec 19, 2016

For those who faced this problem - try https://asset-packagist.org as an alternative.

After adding asset-packagist to your composer.json, as it is described on the site do the following:

  1. Run composer install (or composer update)
  2. Considering that asset-packagist installs assets in a different directory, add the following lines to your application config (usually called as web.php)
$config = [
        'aliases' => [
            '@bower' => '@vendor/bower-asset',
            '@npm'   => '@vendor/npm-asset',
        ],
    ];

See https://asset-packagist.org/site/about to know more

@klimov-paul
Copy link
Member

Relates fxpio/composer-asset-plugin#268

@mrserg161
Copy link

@SilverFire
12334423
composer install is ok, but yii not found jquery

@alxark
Copy link

alxark commented Dec 19, 2016

If your facing this problem:

Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing bower-asset/jquery (1.12.4)
    Downloading: Failed
    Failed to download bower-asset/jquery from dist: The "https://api.github.com/repos/bower-asset/jquery/zipball/a76fe112f860279382d9f6336fe040fd8f8aa13d" file could not be downloaded (HTTP/1.1 404 Not Found)
    Now trying to download from source
  - Installing bower-asset/jquery (1.12.4)
    Cloning a76fe112f860279382d9f6336fe040fd8f8aa13d


  [RuntimeException]
  Failed to clone https://github.com/bower-asset/jquery.git via https, ssh, git protocols, aborting.
  - https://github.com/bower-asset/jquery.git
    Cloning into '/private/var/www/backend/app/vendor/bower-asset/jquery'...
    remote: Repository not found.
    fatal:***@github.com/bower-asset/jquery.git/' not found
  - git@github.com:bower-asset/jquery.git
    Cloning into '/private/var/www/backend/app/vendor/bower-asset/jquery'...
    ERROR: Repository not found.
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.
  - git://github.com/bower-asset/jquery.git
    Cloning into '/private/var/www/backend/app/vendor/bower-asset/jquery'...
    fatal: remote error:
      Repository not found.

to fix this situation you can add this to your composer.json

"repositories": [
       {
           "type": "composer",
           "url": "https://asset-packagist.org"
       }
   ],

@bizley
Copy link
Member

bizley commented Dec 19, 2016

asset-packagist does not respect "bower-asset-library": "vendor/bower" setting probably. Now @bower alias points to vendor/bower and asset-packagist puts bower packages in bower-asset folder.

@http403
Copy link

http403 commented Dec 19, 2016

@mrserg161 paste the following content to config/web.php

$config = [
        ...
        'aliases' => [
            '@bower' => '@vendor/bower-asset',
            '@npm'   => '@vendor/npm-asset',
        ],
        ...
    ];

@SilverFire
Copy link
Member

SilverFire commented Dec 19, 2016

@bizley that's right.

@hartmantam thank you for a right snippet. I've added it to my comment to make the solution complete.

@SilverFire
Copy link
Member

Related: composer/packagist#756

@lan143
Copy link

lan143 commented Dec 19, 2016

@hartmantam after composer install we have 2 bower folders. Is change alias, another packages not found
index

@SilverFire
Copy link
Member

@lan143 forget about vendor/bower and vendor/npm dirs

@lan143
Copy link

lan143 commented Dec 19, 2016

@SilverFire Im remove vendor folder before composer install.

@cebe
Copy link
Member

cebe commented Dec 19, 2016

here is a simple workaround that does not include asset-packagist: fxpio/composer-asset-plugin#268 (comment)

@Yepitis
Copy link

Yepitis commented Dec 19, 2016

https://asset-packagist.org/site/about look this.

@http403
Copy link

http403 commented Dec 19, 2016

@lan143 I didn't encountor this issue tho... and i don't have a bower folder in the vendor. but you can try to move jquery and yii2-pjax in bower to bower-asset, it may solve the problem
bower-asset folder structure

@SilverFire
Copy link
Member

@Charius
Copy link
Contributor

Charius commented Dec 20, 2016

@nkostadinov
Copy link

I still have problem updating via composer

 - Installing bower-asset/jquery.inputmask (3.3.3)
    Downloading: Failed
    Failed to download bower-asset/jquery.inputmask from dist: The "https://api.github.com/repos/bower-asset/jquery.inputmask/zipball/a92cb06b4fe5788ebe7e45e56842c6141632b3ab" file could not be downloaded (HTTP/1.1 404 Not Found)

I cannot find a working solution to this problem though the issue is closed

@Charius
Copy link
Contributor

Charius commented Dec 20, 2016

use asset-packagist.org instead composer-asset-plugin

@nkostadinov
Copy link

@Charius I can switch to asset-packagist, but is this the final solution ? I thought it was just a temporary workaround.

@Charius
Copy link
Contributor

Charius commented Dec 20, 2016

@nkostadinov I guess it's not final solution, otherwise all the issues related with this in other projects are closed, so, there are other options, like https://packagist.org/packages/cebe/assetfree-yii2

@SilverFire
Copy link
Member

Asset-packagist is not a temporary solution. It's a full alternative to fxp/composer-asset-plugin, you are free to choose. We are going to add a guide article about it soon: #13064

@rob006
Copy link
Contributor

rob006 commented Dec 20, 2016

It's a full alternative to fxp/composer-asset-plugin

No, it's not. It still doesn't have some features (and never will) that composer-asset-plugin have: #8688 (comment)

@nkostadinov
Copy link

Well it is not compliant with the current solution. I have my composer packages with their bower dependencies and they do not work. It keeps installing them in vendor/bower. So now I have 60% installed in vendor/bower-asset and other 40% installed in vendor/bower. Does anyone know a fix for this ?

@SilverFire
Copy link
Member

@rob006 it's a full alternative for a general usage scenario. You are right, it does not cover some special cases described via the link you've provided.

Does anyone know a fix for this ?

Most probably https://asset-packagist.org does not know some of your required bower packages.

  1. Remove fxp/composer-asset-plugin from your global composer
  2. Run composer update in your project
  3. Most probably you will see an error that some of your requirements can not be satisfied.
  4. Copy the missing bower-asset/package name and submit it to https://asset-packagist.org
  5. Run composer update again. Repeat 3-5 until all your bower-requirements are submitted

We've already imported top-1500 of npm and bower packages, but we are considering about importing more.

@nkostadinov
Copy link

Aha, I didn't know I have to SUBMIT the packages - that's important information. I thought that that asset-packagist.org did that automatically upon request from composer so you don't have to manually enter each.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests