Ad

Issue When Updating Composer

I am getting an issue when trying to create controllers in Laravel so decided to try and update composer and am getting the following issues when running composer update;

[BadMethodCallException]            
  Call to undefined method [package]  


Script php artisan clear-compiled handling the pre-update-cmd event returned with an error


  [RuntimeException]  
  Error Output:       


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--] [<packages>]...

The error I get when trying to create a new controller;

  [BadMethodCallException]            
  Call to undefined method [package]  

So I believe the 2 to be connected however I may be incorrect.

Output of composer update -vvv

Reading ./composer.json
Loading config file ./composer.json
Executing command (/Users/kieran/Sites/Dev/laravel): git describe --exact-match --tags
Executing command (/Users/kieran/Sites/Dev/laravel): git branch --no-color --no-abbrev -v
Executing command (/Users/kieran/Sites/Dev/laravel): hg branch
Executing command (/Users/kieran/Sites/Dev/laravel): svn info --xml
Reading /Users/kieran/.composer/composer.json
Loading config file /Users/kieran/.composer/composer.json
> pre-update-cmd: php artisan clear-compiled
Executing command (CWD): php artisan clear-compiled


  [BadMethodCallException]            
  Call to undefined method [package]  


Script php artisan clear-compiled handling the pre-update-cmd event returned with an error


  [RuntimeException]  
  Error Output:       


Exception trace:
 () at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:196
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:94
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:196
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:159
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:840
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:167
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:98
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:25

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--] [<packages>]...
Ad

Answer

The undefined method [package] can often be from trying to use a package that was built for Laravel 4 in Laravel 5.

The package method was removed from Service Providers in Laravel 5+.

Check any package service providers for a call to the package method on the provider.

Ad
source: stackoverflow.com
Ad