Laravel BadMethodCallException运行composer update时调用未定义的方法[package]

时间:2014-12-11 13:07:46

标签: laravel laravel-4 composer-php

我正在尝试在Laravel 4.2项目中使用此程序包https://github.com/laracasts/Validation

这是我的composer.json文件条目:

"require": {
    ...
    "laracasts/validation": "~1.0"
},

现在,当我运行 composer update 命令时,我收到了以下错误:

{  
  "error":{  
    "type":"BadMethodCallException",
    "message":"Call to undefined method [package]",
    "file":"C:\\wamp\\www\\project-name\\vendor\\illuminate\\support\\ServiceProvider.php",
    "line":111
  }
}{  
  "error":{  
    "type":"BadMethodCallException",
    "message":"Call to undefined method [package]",
    "file":"C:\\wamp\\www\\project-name\\vendor\\illuminate\\support\\ServiceProvider.php",
    "line":111
  }
}

这是完整输出:

C:\wamp\www\project-name>composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
{"error":{"type":"BadMethodCallException","message":"Call to undefined method [package]","file":"C:\\wamp\\www\\project-name\\vendor\\illuminate\\support\\ServiceProvider.php","line":111}}{"error":{"type":"BadMethodCallException","message":"Call to undefined method [package]","file":"C:\\wamp\\www\\project-name\\vendor\\illuminate\\support\\ServiceProvider.php","line":111}}
C:\wamp\www\project-name>

知道这是关于什么以及如何解决它?

2 个答案:

答案 0 :(得分:2)

确保使用composer的最新版本。使用self-update命令将编辑器本身更新为其最新版本。

composer self-update

答案 1 :(得分:0)

您确定使用的是Laravel 4.2而不是Laravel 5吗?

Laravel 5甚至还没有进入阿尔法,所以事情随时都会破裂。

Currently, laravel 5 packages are completely broken