yiisoft / yii2

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

bower-asset/jquery error installing advanced via composer #14925

Closed bluezed closed 6 years ago

bluezed commented 6 years ago

I'm trying to install the 2.0.12 advanced application via composer and run into an error which I've not been able to figure out yet.

What steps will reproduce the problem?

Using the steps in the Guide: composer global require "fxp/composer-asset-plugin:^1.2.0" composer create-project yiisoft/yii2-app-advanced advanced 2.0.12

What is the expected result?

Working advanced apllication.

What do you get instead?

[admin@localhost public_html]$ composer global require "fxp/composer-asset-plugin:^1.2.0"
Changed current directory to /home/admin/.config/composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
[admin@localhost public_html]$ composer create-project yiisoft/yii2-app-advanced advanced 2.0.12
Installing yiisoft/yii2-app-advanced (2.0.12)
  - Installing yiisoft/yii2-app-advanced (2.0.12): Downloading (100%)         
Created project in advanced
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - yiisoft/yii2 2.0.9 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.8 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.12 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.11.2 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.11.1 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.11 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.10 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - Installation request for yiisoft/yii2 ~2.0.6 -> satisfiable by yiisoft/yii2[2.0.10, 2.0.11, 2.0.11.1, 2.0.11.2, 2.0.12, 2.0.6, 2.0.7, 2.0.8, 2.0.9].

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://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Additional info

Q A
Yii version 2.0.12
PHP version 7.1
Operating system Fedora 26
schmunk42 commented 6 years ago

Could you run that again with -vvv? Looks like this in my case

create-project -vvv yiisoft/yii2-app-advanced advanced 2.0.12

It's very strange sind composer should not do any dependency resolution at all?!

yii-bot commented 6 years ago

Thanks for posting in our issue tracker. In order to properly assist you, we need additional information:

Thanks!

This is an automated comment, triggered by adding the label status:need more info.

rob006 commented 6 years ago

https://github.com/yiisoft/yii2-app-advanced/blob/2.0.12/docs/guide/start-installation.md

Try with composer global require "fxp/composer-asset-plugin:^1.3.1".

schmunk42 commented 6 years ago

The actual version of fxp/composer-asset-plugin would be interesting, but should even be 1.4.1 if there are no updates like in the first log.

composer global show
bluezed commented 6 years ago

Thanks for the replies!

[admin@localhost public_html]$ composer global show
Changed current directory to /home/admin/.config/composer
fxp/composer-asset-plugin v1.4.1 NPM/Bower Dependency Manager for Composer

And composer create-project -vvv yiisoft/yii2-app-advanced advanced 2.0.12 has this result: https://gist.github.com/bluezed/584e1349a52e12cb4742258942f47085

schmunk42 commented 6 years ago

You have some proxy inbetween

Downloading https://bower.herokuapp.com/packages/typeahead.js using proxy tcp://proxywww.nos.office:3128
Downloading http://packagist.org/p/bower-asset/punycode%240d7fa26cd8cda246a5c045d7b1365401c06ab706a51abac17a5a161c68413e76.json using proxy tcp://proxywww.nos.office:3128

Could you try to disable that.

bluezed commented 6 years ago

Yes, that's the only way to get to the internet from the office. No way around it unfortunately :(

Just wanted to add... I now tried exactly the same thing on a SLES12 machine which uses the same proxy and there it works fine.

Could there be something on that Fedora 26 machine causing this!? It's a freshly installed workstation...

schmunk42 commented 6 years ago

Open & compare the output of some URLs on different machines, ie. https://packagist.org/p/bower-asset/punycode%240d7fa26cd8cda246a5c045d7b1365401c06ab706a51abac17a5a161c68413e76.json

If that's also the same, try to clear composer caches.

Does not look like a Yii2 issue to me, therefore I am closing it.

S1AnGeR commented 6 years ago

@schmunk42 I have same issue as @bluezed with proxy on my office , and without proxy at my home too.

This is log with -vvv option https://pastebin.com/EvQxHwiy

Please help

schmunk42 commented 6 years ago

Does

composer clear-cache

or removing the vendor folder help?

bluezed commented 6 years ago

For me composer clear-cache did not make a difference and the vendor folder does not even exist yet at the time when the error occurs.

schmunk42 commented 6 years ago

@S1AnGeR You are missing the FxpAssetPlugin, there should be such a line in the logs

Loading plugin Fxp\Composer\AssetPlugin\FxpAssetPlugin_composer

@bluezed What looks strange to me in your logs are lines like

Downloading http://packagist.org/p/bower-asset/typeahead.js%24815d31dd9c50c84c1f26743f638197c08e46a6b7bb8822c72c097ed21524fd65.json using proxy tcp://proxywww.nos.office:3128
Writing /home/admin/.cache/composer/repo/https---packagist.org/provider-bower-asset$typeahead.js.json into cache

I get an 404 error from packagist.org, when I try access it. Moreover, I even haven't such entries in the log. There should also be no information about it on packagist.org?! @francoispluchino

Before the error, there are those lines

Reading C:/Users/desun/AppData/Local/Composer/repo/https---packagist.org/provider-bower-asset$jquery.json from cache
Reading C:/Users/desun/AppData/Local/Composer/repo/https---packagist.org/provider-bower-asset$jquery.json from cache
Reading C:/Users/desun/AppData/Local/Composer/repo/https---packagist.org/provider-bower-asset$jquery.json from cache
Reading C:/Users/desun/AppData/Local/Composer/repo/https---packagist.org/provider-bower-asset$jquery.json from cache
Reading C:/Users/desun/AppData/Local/Composer/repo/https---packagist.org/provider-bower-asset$jquery.json from cache
Reading C:/Users/desun/AppData/Local/Composer/repo/https---packagist.org/provider-bower-asset$jquery.json from cache
Reading C:/Users/desun/AppData/Local/Composer/repo/https---packagist.org/provider-bower-asset$jquery.json from cache
Reading C:/Users/desun/AppData/Local/Composer/repo/https---packagist.org/provider-bower-asset$jquery.json from cache
Reading C:/Users/desun/AppData/Local/Composer/repo/https---packagist.org/provider-bower-asset$jquery.json from cache

I wonder why composer tries to load the same file 10 times?! Can you check the contents of the file and also the response in curl and with your browser, is it valid json?


As a workaround you might try this...

FXP_ASSET__VCS_DRIVER_OPTIONS='{"github-no-api": true}' composer create-project -vvv yiisoft/yii2-app-advanced advanced-noapi 2.0.12
bluezed commented 6 years ago

Just checked the file in cache and the one downloaded from packagist and both completely match and seem valid. This is the link it used this time: http://packagist.org/p/bower-asset/jquery%24542269e8b1db94fee3ee9352fc3e24f57a2dfd8cd292430defe7b4a9bd2df7ae.json It works fine from here... but I guess maybe the token it uses is only valid for a certain amount of time hence later the 404 may be displayed?

Unfortunately the workaround also didn't make a difference. Still the same error.

Thank you very much for continuing to try to help with this. Much appreciated!

schmunk42 commented 6 years ago

You don't have FXP_ASSET__ENABLED=0 in your env or in composer.json (globally) haven't you?

That's the only way I can reproduce a similar behavior: https://gist.github.com/schmunk42/3ceb2f44d4d7e2ba365b8836f2c64aaa while seeing a loaded plugin.

With dev-master this would be no issue, since there's a fallback on asset-packagist.org.

bluezed commented 6 years ago

No, nothing like that in env or global composer.json.

As mentioned before it's a freshly installed Fedora 26 workstation. Only change from "stock" is that I use a proxy. Nothing else has been touched.

And yes, dev-master can be installed. Guess I'll use that for now...

schmunk42 commented 6 years ago

I tried building a Fedora 26 + PHP image with Docker...

Dockerfile

FROM fedora:26

# Install php & git
RUN yum -y install php git

# Install composer
ENV PATH=/usr/local/bin:$PATH
RUN curl -sS https://getcomposer.org/installer | php -- \
        --filename=composer \
        --install-dir=/usr/local/bin && \
    composer global require --optimize-autoloader \
        "fxp/composer-asset-plugin:^1.4.1" && \
    composer global dumpautoload --optimize && \
    composer clear-cache

Build

docker build . -t test/issue14925

Run

docker run --rm -it test/issue14925 bash

Create app in container

$ composer create-project -vvv yiisoft/yii2-app-advanced advanced 2.0.12 --ignore-platform-reqs

Works. I am at my wit's end, sorry.

bluezed commented 6 years ago

Thanks for trying!

It probably is something to do with the proxy as I just tried it at home with a fresh Fedora 26 VM and it works without problems.

So... I'll work around the issue as it's only for one project.

Thank you!

IvoPereira commented 6 years ago

I was having the same exact behaviour as described. I have been able to fix it by using the steps mentioned here.

Axtershub commented 1 year ago

I am facing the same issue while running the composer update command. Due to this issue, I am unable to integrate any new components into my project. Error as shown below-

Problem 1

To enable extensions, verify that they are enabled in your .ini files:

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.