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

Calling unknown method: yii\web\UrlManager::addRules() #5060

Closed
3dmaxpayne opened this issue Sep 17, 2014 · 111 comments
Closed

Calling unknown method: yii\web\UrlManager::addRules() #5060

3dmaxpayne opened this issue Sep 17, 2014 · 111 comments
Labels
Milestone

Comments

@3dmaxpayne
Copy link

@3dmaxpayne 3dmaxpayne commented Sep 17, 2014

Hello! Thank you for your work!
I have updated today by composer and found this error:

http://awesomescreenshot.com/0ff3hzs143

Do you have removed this method anywhere except debug mode?

@Famers
Copy link
Contributor

@Famers Famers commented Sep 17, 2014

I also encountered this problem.

@huaiguoguo
Copy link

@huaiguoguo huaiguoguo commented Sep 17, 2014

I also encountered this problem.
强哥啊,我也遇到这个问题了,一更新,就出现这个情况。。。。啥时候能解决啊。。

@zqtsx
Copy link

@zqtsx zqtsx commented Sep 17, 2014

我今天上午刚换的YII2.0 刚装上去就是这个提示
Unknown Method – yii\base\UnknownMethodException
Calling unknown method: yii\web\UrlManager::addRules()

@zqtsx
Copy link

@zqtsx zqtsx commented Sep 17, 2014

上面是完成 错误提示

@pahanini
Copy link

@pahanini pahanini commented Sep 17, 2014

Also affects to me

@zqtsx
Copy link

@zqtsx zqtsx commented Sep 17, 2014

you too ?

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 17, 2014

composer install --dev

@huaiguoguo
Copy link

@huaiguoguo huaiguoguo commented Sep 17, 2014

composer install --dev 能行吗,我们这是更新啊。。。

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 17, 2014

чё ? 。。。。。。。。。。。。

@zqtsx
Copy link

@zqtsx zqtsx commented Sep 17, 2014

composer install --dev 这玩意不行啊

@zqtsx
Copy link

@zqtsx zqtsx commented Sep 17, 2014

“composer install --dev ” is don't ok.

@aquy
Copy link
Contributor

@aquy aquy commented Sep 17, 2014

I have the same problem

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 17, 2014

The whole world has such a problem. So there is no report;)

@zqtsx
Copy link

@zqtsx zqtsx commented Sep 17, 2014

you can speaking china language ? who can help me kill this bug?

@huaiguoguo
Copy link

@huaiguoguo huaiguoguo commented Sep 17, 2014

都是中国人,为什么都不说中文,说英文很洋气么?

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 17, 2014

I still adapts to the c234359
See extra ..

@bryglen
Copy link

@bryglen bryglen commented Sep 17, 2014

this thing kills me as well.. it was pulling some previous version

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 17, 2014

Yes it is

Add to composer.json

 "extra": {
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    }

And run
http://i.imgur.com/h3u1sqX.jpg

@zqtsx
Copy link

@zqtsx zqtsx commented Sep 17, 2014

楼上的方法也不行啊……

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 17, 2014

Google translator don't understand you ^_^

@mousemckill
Copy link

@mousemckill mousemckill commented Sep 17, 2014

Почему требует логин и пароль?

@zqtsx
Copy link

@zqtsx zqtsx commented Sep 17, 2014

按照你的办法也添加了那段代码,还是不行啊

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 17, 2014

@mousemckill потому, что предоставляются права доступа composer для работы с api GITHUB

Посмотреть для кого, что доступно можно по адресу https://github.com/settings/applications

@bryglen
Copy link

@bryglen bryglen commented Sep 17, 2014

guys. english please since this is world issue :)

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 17, 2014

@bryglen if something is not by English then it is offtopic. :)

@huaiguoguo
Copy link

@huaiguoguo huaiguoguo commented Sep 17, 2014

stop!!!!!!!!!!!!!!!!!!! please stop talk this problom of english.....ok?

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 17, 2014

NOT OK! My solution help someone?

@bryglen
Copy link

@bryglen bryglen commented Sep 17, 2014

I still get sme error @githubjeka

@bayusuwarninghadi
Copy link

@bayusuwarninghadi bayusuwarninghadi commented Sep 18, 2014

Now, how to register js/css file?

use yii\web\JqueryAsset;
$this->registerJsFile(Yii::$app->getHomeUrl().'js/docs.min.js',[JqueryAsset::className()]);

-->

<script src="/js/docs.min.js" 0="yii\web\JqueryAsset"></script>
<script src="/assets/2944290e/jquery.js"></script>

script generated before jquery

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 18, 2014

Use

use yii\web\JqueryAsset;
$this->registerJsFile(
    Yii::$app->getHomeUrl().'js/docs.min.js',
    [
        'depends'=>JqueryAsset::className()
    ]
);

The current issue nothing to do with your code

@3dmaxpayne
Copy link
Author

@3dmaxpayne 3dmaxpayne commented Sep 18, 2014

But guys, I still don't understand. You use this code in yii\debug\Module

$app->getUrlManager()->addRules([
$this->id => $this->id,
$this->id . '/controller:w+/action:w+' => $this->id . '//',
], false);

But I have not find any declaration of this method: addRules. So, where is declaration of it?

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 18, 2014

@hoksilato
Copy link
Contributor

@hoksilato hoksilato commented Sep 19, 2014

@githubjeka I followed your instruction and get error like below.

yii2-beta

I also tried to create new fresh project and it always got stuck at "Reading bower.json of bower-assets/requirejs" and then killed the process.

Can you help me? Thanks.

P/S: I'm using Cygwin + Windows 8.1 + Vagrant CentOS 6.5

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 19, 2014

@hoksilato
Copy link
Contributor

@hoksilato hoksilato commented Sep 19, 2014

Thanks @githubjeka

@Shybko
Copy link
Contributor

@Shybko Shybko commented Sep 19, 2014

I'm trying code from this page http://www.yiiframework.com/doc-2.0/guide-start-installation.html for installation Yii2
Using this code
composer global require "fxp/composer-asset-plugin:1.0.*@dev"
then try this
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
and this
composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
And finally get this result
composer error
How it fixed? :(

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 19, 2014

@stratigos
Copy link

@stratigos stratigos commented Sep 20, 2014

Went on vacation for 2 weeks and came back to this. Spent the morning resolving the original issue, and then the issue(s) Shybko had. Was able to resolve by adding bower-asset/jquery etc to my composer.json.

@geekwho11
Copy link

@geekwho11 geekwho11 commented Sep 22, 2014

You must updtae composer to lastes version.
composer self-update
and then do
#5060 (comment)
work fine.

@Shybko
Copy link
Contributor

@Shybko Shybko commented Sep 23, 2014

This #5107 (comment) solution helped me

@niugengyun
Copy link

@niugengyun niugengyun commented Sep 25, 2014

http://www.cnsecer.com/6054.html 不要谢我! i am leifeng!

@gephaest
Copy link
Contributor

@gephaest gephaest commented Sep 29, 2014

I have same problem, my console:

composer self-update
composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic

Add to composer.json:

"extra": {
    "asset-installer-paths": {
        "npm-asset-library": "vendor/npm",
        "bower-asset-library": "vendor/bower"
    }
}

Console:

composer global require "fxp/composer-asset-plugin:1.0.*@dev"
composer update --dev --dry-run

And I have error:
Calling unknown method: yii\web\UrlManager::addRules().
In UrlManager.php addRules doesn't exist.

My composer.json: https://gist.github.com/gephaest/7e973935161edd5869b7

@samdark
Copy link
Member

@samdark samdark commented Sep 29, 2014

First fxp/composer-asset-plugin then update.

@gephaest
Copy link
Contributor

@gephaest gephaest commented Sep 29, 2014

@samdark I did so, but yii2 don't running

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 29, 2014

Read guide! what is it 1.0.*@dev" ?

@hoksilato
Copy link
Contributor

@hoksilato hoksilato commented Sep 29, 2014

@gephaest you should use composer global require "fxp/composer-asset-plugin:1.0.0-beta2" instead of composer global require "fxp/composer-asset-plugin:1.0.*@dev".

Delete your vendor directory and composer.lock.

Then composer install --prefer-dist.

@gephaest
Copy link
Contributor

@gephaest gephaest commented Sep 29, 2014

@hoksilato thanks. I'm new with Composer. I was following by this instructions: #5060 (comment) :)

Your method works fine. Thanks!

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 29, 2014

@samdark please lock conversation on this issue and add link to latest guide of installation. :)

@githubjeka
Copy link
Contributor

@githubjeka githubjeka commented Sep 29, 2014

Not? Well, okay.

@yiisoft yiisoft locked and limited conversation to collaborators Sep 29, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.