Laravel BadMethodCallException Call to undefined method [package] when running composer update - laravel

I am trying to use this package https://github.com/laracasts/Validation in my Laravel 4.2 project.
This is my composer.json file entry:
"require": {
...
"laracasts/validation": "~1.0"
},
Now when I run the composer update command, I get the following error at the end:
{
"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
}
}
This is the full output:
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>
Any idea what this is about and how to fix it?

Make sure you use the latest version of composer. Use the self-update command to update composer itself to its newest version.
composer self-update

Are you sure you're using Laravel 4.2 and not Laravel 5?
Laravel 5 is not even in alpha yet, so things can break at any moment.
Currently, laravel 5 packages are completely broken.

Related

Call to undefined method Laravel\Lumen\Routing\Router::middleware()

After the artisan command composer require dusterio/lumen-passport the error comes Call to undefined method Laravel\Lumen\Routing\Router::middleware()
I dont know why this error occured
I am trying to installing the passport package on laravel lumen framework but because of the error nothing happened
This seems similar to this issue:
https://github.com/dusterio/lumen-passport/issues/175
Try to follow this:
Localized problem, it is some incompatibility with the new version of Passport v11. Adding in composer.json the following line works correctly with Lumen 9:
"laravel/passport": "^10.4"

PHP Fatal error: Class UpdateHelper\ComposerPlugin contains 2 abstract methods in laravel

I want to install laravel on my windows but getting below error
Using below command install laravel
composer create-project --prefer-dist laravel/laravel:^7.0 learning-app
But getting below error in command prompt after run the composer command
PHP Fatal error: Class UpdateHelper\ComposerPlugin contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Composer\Plugin\PluginInterface::deactivate, Composer\Plugin\PluginInterface::uninstall) in C:\xampp\htdocs\vendor\kylekatarnls\update-helper\src\UpdateHelper\ComposerPlugin.php on line 11
Trying all the commands like composer update but not getting any success.
My php version PHP 7.3.27
Anyone have idea how to solve then let me know
You're trying to install the laravel framework locked at a version released more than 2 years ago, is there a reason for this?
Also, what is the version of your composer (run composer --version)? If you're at the version 2 try downgrading to v1 and try again with the same command, if you really want the 7.0 version of Laravel (or simply install the newest version of the framework).

Lumen throwing error: Uncaught Error: Class 'Laravel\Lumen\Bootstrap\LoadEnvironmentVariables' not found in /var/www/bootstrap/app.php:5

I am working on a Laravel Lumen project. I am trying to spin up the existing project locally. First I installed the composer by running, "composer install". When I run the migration command, "php artisan migrate", I am getting the following error.
Fatal error: Uncaught Error: Class 'Laravel\Lumen\Bootstrap\LoadEnvironmentVariables' not found in /var/www/bootstrap/app.php:5
Stack trace:
#0 /var/www/artisan(18): require()
#1 {main}
thrown in /var/www/bootstrap/app.php on line 5
I tried deleting the vendor folder and running composer install again. It did not work. The class does not seem to exist either. But the composer was installed successfully. I am using Lumen version 7.0. What is wrong with it and how can I fix it?
Make sure you actually require the lumen package i.e. make sure your composer.json contains:
"require": {
"php": "^7.2.5",
"laravel/lumen-framework": "^7.0"
},
Afterwards run composer install again. If it worked then a folder /vendor/laravel/lumen-framework should be present
See official composer.json template for Lumen 7.0: https://github.com/laravel/lumen/blob/7.x/composer.json

Error "Installation failed, reverting ./composer.json to its original content."

I wanna connect my Laravel project to parse-server. And I follow the step in https://github.com/LaravelParse/Laravel-Parse
when I run this command:
composer require laravel-parse/parse
Then I got an error:
Installation failed, reverting ./composer.json to its original content.
I also tried to add in composer.json file:
"require": {
"laravel-parse/parse": "^3.0"
}
My Laravel version is: 5.7.18
Package's composer.json(Read Lineno 18,19) says this laravel must be up to Laravel 5.4. You can not use this laravel 5.5, 5.6, 5.7, it's incompatible.
if you want use this(Laravel Parse) you need laravel 5.4
NOTE: I tested in Laravel version 5.5,5.6 and 5.7, it is now not supported

Laravel 4 - Composer could not load package

I am trying to update composer in a Laravel 4 project, but I get this error:
[RuntimeException] Could not load package psy/psysh in
http://packagist.org: [UnexpectedValueException] Could not parse
version constraint ^2.4.2: Invalid version string "^2.4.2"
I haven't used psy/psysh within my project. Why is this returned? How can I solve this and run composer update?
The ^ character in version strings is a relatively new composer feature. Update your version of the package manager and you should be good to go
composer self-update

Resources