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 error. #5061

Closed
mithun12000 opened this issue Sep 17, 2014 · 40 comments
Closed

Composer error. #5061

mithun12000 opened this issue Sep 17, 2014 · 40 comments
Assignees
Labels
status:to be verified Needs to be reproduced and validated.
Milestone

Comments

@mithun12000
Copy link

yiisoft/yii2 dev-master requires bower-asset/jquery >=1.8 -> no matching package found.

@githubjeka
Copy link
Contributor

see #5060 (comment)

@mithun12000
Copy link
Author

That done.

Now issue is Jquery is not getting loaded.

as in code used.

dist/jquery.js

but dist folder not found.

@githubjeka
Copy link
Contributor

/vendor/bower/jquery/src/jquery.js

@mithun12000
Copy link
Author

can you please chnage and commit so i can take composer update.

@mithun12000
Copy link
Author

Also while running composer update it ask me git username and password is there any way i can avoid that for deployment process?

@githubjeka
Copy link
Contributor

#5060 (comment)

@philippfrenzel
Copy link
Contributor

Hi, I followed the description, but all assets are not beeing loaded into the webapp?

@githubjeka
Copy link
Contributor

Why not? Loaded.
see folder \vendor\bower it folder for css and js libraries.
forlder vendors for others

@githubjeka
Copy link
Contributor

@mithun12000

class JqueryAsset extends AssetBundle
{
    public $sourcePath = '@bower/jquery';
    public $js = [
        'dist/jquery.js',
    ];
}

just add to your yii2-app-advanced/frontend/assets/AppAsset.php

 public $depends = [       
        'yii\web\YiiAsset',
        //...
    ];

@mithun12000
Copy link
Author

class JqueryAsset extends AssetBundle
{
    public $sourcePath = '@bower/jquery';
    public $js = [
        'dist/jquery.js',
    ];
}

this is already added.

but path is invalid as dist is missing.

@githubjeka
Copy link
Contributor

Is folder vendor\bower\jquery exist?

@mithun12000
Copy link
Author

yes
folders are
src
external

@githubjeka
Copy link
Contributor

please show your composer.json

@mithun12000
Copy link
Author

{
    "name": "Timescity/NewCMS",
    "description": "CMS for Timescity",
    "keywords": ["yii2", "framework", "CMS", "Admin"],
    "homepage": "http:https://www.timescity.com/",
    "type": "project",
    "license": "BSD-3-Clause",  
    "minimum-stability": "dev", 
    "require": {
        "php": ">=5.4.0",                
        "yiisoft/yii2": "*",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-swiftmailer": "*",
        "kartik-v/yii2-widgets":"*",
        "yiisoft/yii2-imagine":"*",
        "yiisoft/yii2-redis":"*",
                "sammaye/yii2-audittrail": "dev-master",
        "demogorgorn/yii2-ajax-submit-button": "*"
    },
    "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"
    },
    "scripts": {
        "post-create-project-cmd": [
            "yii\\composer\\Installer::setPermission"
        ]
    },
    "config": {
        "process-timeout": 1800
    },
    "extra": {
        "asset-installer-paths": {
                    "npm-asset-library": "vendor/npm",
                    "bower-asset-library": "vendor/bower"
                }
    }
}

@samdark samdark added this to the 2.0 RC milestone Sep 17, 2014
@samdark samdark added the status:to be verified Needs to be reproduced and validated. label Sep 17, 2014
@bryglen
Copy link

bryglen commented Sep 17, 2014

see comment #5059

@githubjeka
Copy link
Contributor

clean the entire folder @web/asset
and you see yii2-app-advanced/frontend/web/assets/cf456928/dist/jquery.js not found
for JqueryAsset with "bower-asset/jquery": ">=1.8",

@githubjeka
Copy link
Contributor

And all because they all followed and removed this line here
c234359#diff-b5d0ee8c97c7abd7e3fa29b9a27d1780L79 :)

@philippfrenzel
Copy link
Contributor

I have all files under vendor bower and after removing the @web/assets folder it's back "working" - can someone pls add a "how to" for this asset management change? even maybe here so really all needed steps are in a chronological order listed

@githubjeka
Copy link
Contributor

For example

<?php
namespace frontend\assets;

use yii\web\AssetBundle;

class AngularAsset extends AssetBundle
{
    public $sourcePath = '@bower';

    public $js = [
        'angular/angular.min.js',
        'angular-animate/angular-animate.min.js',
    ];
}

In composer.json

 "require": {       
        "bower-asset/angular": "1.2.25",
        "bower-asset/angular-animate": "dev-master"
    },

@qiangxue
Copy link
Member

The problem is because jquery 2.1 and prior versions have different folder structures. I just checked in a fix to use yiisoft/jquery composer package. The problem should be gone. (Please wait for 10 minutes to allow changes to be propagated.)

@samdark
Copy link
Member

samdark commented Sep 17, 2014

Can we somehow get verison and adjust bundle path based on it? I don't like that we're still using mirrors.

@qiangxue
Copy link
Member

Theoretically each release of Yii should use fixed versions of dependent packages. So this problem shouldn't appear in formal releases. In case an application uses a different version, the user can still use asset manager to configure asset bundle to customize the actual paths.

@qiangxue
Copy link
Member

Well, actually there is still a problem if we use jquery bower package and want to support both 2.0 and 2.1 since their directory structures are different. So perhaps we will stick to yiisoft/jquery to avoid troubles.

@samdark
Copy link
Member

samdark commented Sep 17, 2014

Then any bower package that requires jquery will trigger additional download, won't it?

@gimox
Copy link
Contributor

gimox commented Sep 17, 2014

can we came back to previous commit before "bower" ?

@qiangxue
Copy link
Member

@samdark Yes, that's managed by bower. We have no control over it.

@qiangxue
Copy link
Member

@gimox Sorry if this change brought you troubles. We have to make this change because it is a major step forward that we have to make. We did expect that there could be all sorts of troubles during this transition period. We will try to solve them asap.

@gimox
Copy link
Contributor

gimox commented Sep 17, 2014

what about if in jquery relase the structure of dir change?

@arturf
Copy link
Contributor

arturf commented Sep 17, 2014

@gimox since stable version (October 12 :)), framework will have a stable version of jQuery, so risk of today problem is minimal

@gimox
Copy link
Contributor

gimox commented Sep 17, 2014

i develop for bank and financial, for our team minimal is not aceptable.
Composer and other automated tools are great and the gool is update the security without break the project. So i we introduce somethink that can be instable, the solution is not use composer... and came back to 3 years ago...
So yii2 need to be compare with symphony2 or other framework, composer must be safe always.

@cebe
Copy link
Member

cebe commented Sep 17, 2014

i develop for bank and financial, for our team minimal is not aceptable.

yii is currently in development and we explicitily stated that things will change and we will not keep BC until final release of 2.0.

@arturf
Copy link
Contributor

arturf commented Sep 17, 2014

You can use composer and set dependencies's version strongly in your composer.json to minimize risk of project's breaking. It may be good practice especially for bank/financial projects.

@gimox
Copy link
Contributor

gimox commented Sep 17, 2014

it's impossible to say if jquery 2.2.9 has will have the same identical structure compared to 2.2.1

we need to check manually

@arturf
Copy link
Contributor

arturf commented Sep 17, 2014

we need to check manually

It's a more right way... доверяй, но проверяй :)

@gimox
Copy link
Contributor

gimox commented Sep 17, 2014

mmm composer is usefull to update dependance without panic.

@allyraza
Copy link

interesting instead of making it easy for new users / beginners. we kicking up a notch now with this bower and npm are officially yii2 dependencies

@githubjeka
Copy link
Contributor

When the "global connector of bower" will be moved to composer.json then beginners will not notice this dependence

@cebe
Copy link
Member

cebe commented Sep 18, 2014

interesting instead of making it easy for new users / beginners. we kicking up a notch now with this bower and npm are officially yii2 dependencies

we are explicitly not requiring NPM or bower to be installed on your system but use a composer plugin to avoid this step. There is a pull request open on composer side that will allow this all to be installed automatically. It is just not merged now so you have to make one step installing the plugin yourself.

@dniznick
Copy link

Update: Not working, jquery still not loaded...

FYI

I tried all the solutions posted without success. I am new to composer and do not yet understand the issue here that well.

However, what worked for me:

Symlink (linux) the /src folder to 'dist'. As I understand this package changed its file location from /src to /dist so this will work for now.

@cebe
Copy link
Member

cebe commented Sep 23, 2014

@dniznick with the latest version of yii + composer asset plugin everything should work fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated.
Projects
None yet
Development

No branches or pull requests