Class 'Illuminate\Routing\ControllerServiceProvider' not found [duplicate] - laravel

I have updated the composer.json file as instructed on the upgrade guide on Laravel 5.2 Documentation and run composer update.
Everything was updated correctly, but composer dumped the error below while generating autoload files.
Class 'Illuminate\Routing\ControllerService Provider' not found in /home/vagrant/Code/homework/vendor/laravel/framework /src/Illuminate/Foundation/ProviderRepository.php on line 146

Make sure you remove Illuminate\Routing\ControllerServiceProvider from your /config/app.php.
https://www.laravel.com/docs/5.2/upgrade (see the "Service Providers" section)

Problem is with your composer.json.It may got corrupted. Make sure
"require": {
"laravel/framework": "5.2.*"
},
exists.Then run composer update.

Related

Argument 1 passed to League\\Flysystem\\AwsS3v3\\AwsS3Adapter::__construct() must be an instance of Aws\\S3Client, instance of Aws\\S3\\S3Client given [duplicate]

I have installed the s3 flysystem package by running the following composer command in my Laravel 8 project
composer require --with-all-dependencies league/flysystem-aws-s3-v3 "^1.0"
and tried to store a file from the request as
$imageName = $request->file('file')->store('uploads');
I got the following error
League\Flysystem\AwsS3v3\AwsS3Adapter::__construct(): Argument #1
($client) must be of type Aws\S3Client, Aws\S3\S3Client given, called
in
D:\Projects\Rescale\vendor\laravel\framework\src\Illuminate\Filesystem\FilesystemManager.php
on line 229
So it seems ThePHPLeague Flysystem major version got updated (to v2) thus breaking a lot of stuff since latest Laravel depends on "^1.1" (see: https://github.com/laravel/framework/blob/8.x/composer.json#L27).
I've had this error, so my workaround is to use a specific version instead.
Go to composer.json and use latest v1 (see: https://github.com/thephpleague/flysystem-aws-s3-v3/tags).
- "league/flysystem-aws-s3-v3": "^1.0",
+ "league/flysystem-aws-s3-v3": "1.0.29",
Run composer update and let composer update your dependencies.
try this to upload an image on AWS
$path = Storage::disk('s3')->put('uploads', $request->file('file'));
try this
composer require --with-all-dependencies league/flysystem-aws-s3-v3 "~1.0"
I got same error in Laravel version 8
open composer.json and change inside version to "league/flysystem-aws-s3-v3": "^1.0"
run composer update

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

Script codecept handling the __exec_command event returned with error code 255

I am very new to unit testing and have been trying to use codeception to do it. So I have followed the following guidelines link
and installed it using composer: composer require "codeception/codeception" --dev, it was successful, but when I tried to set it up using composer exec codecept bootstrap I got the following error:
Script codecept handling the __exec_command event returned with error
code 255
Anyone knows how to fix it?
Just FYI, I have pulled the whole project from a repo that already has the tests/unit folder with previous tests already.
My composer.json file has the following
"require": {
"codeception/robo-paracept": "dev-master",
},
"require-dev": {
"codeception/codeception": "2.6.x-dev",
Apparently the issue was with the php version that I was using. I am using 7.3; using 7.2 solved my problem and the whole thing went smoothly.
Run the command with the -v option to show verbose output.
In my case there where unallowed tabs in my tests/functional.suite.yml file.
I replaced them with 4 spaces and everything was fine.

Symfony parse error in output.php when creating project in laravel

Installed laravel 5.6
Have PHP 7.0 installed as well.
When I try
laravel new sample-project
it creates the required files and dependencies but bails with an error below:
PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /home/johndoe/laravel/sample-project/vendor/symfony/console/Output/Output.php on line 40
Have a feeling this might be due to issues with the symfony file but not sure how to go about getting the right version or making a change in Output.php
Trying any other command such as
php artisan list
results in the same error
Composer relevant section denoting laravel 5.6 / php 7.1.3
"require": {
"php": "^7.1.3",
"fideloper/proxy": "~4.0",
"laravel/framework": "5.6.*",
"laravel/tinker": "~1.0"
},
Any help would be appreciated.
EDIT
Based on the answer I had to create a project with laravel version 5.5 which means I had to use
composer create-project laravel/laravel sample-project "5.5.*"
That worked.
Laravel 5.6 requires PHP > 7.1.3
you will need to make sure your server meets the following
requirements:
PHP >= 7.1.3
I ended up having to edit the $PATH in my .bashrc file, because it was picking up an old version of php.
> whereis php
> echo $PATH
I found the correct version of php here: /opt/php71/bin
So now my .bashrc file looks like this:
export PATH=/opt/php71/bin:$PATH
This fixed the error I was getting in composer, AND now php artisan also works!
:-D
PS. The version of php that you're using in the shell may be different from the version used to serve your site. That can be fixed in cpanel's php selector.

yii2 composer update error: Invalid version string "2.*"

I'm use composer update in a Yii2 project, but it is exiting with an exception.
I have updated composer to the lastest version, c6cc6dd6070871f4b198ed39f76dd8047c116b02, but it still doesn't work:
Importing tag v2.0.2 (2.0.2.0)
Reading bower.json of bower-asset/yii2-pjax (v2.0.1)
Reading /home/xiaoai/.composer/cache/repo/github.com/yiisoft/jquery-pjax/bower-f07ce95f6098c0bd5421789a20789f39a19be73b from cache
Importing tag v2.0.1 (2.0.1.0)
Reading /home/xiaoai/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-bootstrap.json from cache
Reading /home/xiaoai/.composer/cache/repo/https---packagist.org/provider-bower-asset$bootstrap.json from cache
Downloading https://bower.herokuapp.com/packages/bootstrap
Writing /home/xiaoai/.composer/cache/repo/https---bower.herokuapp.com-packages/bootstrap-3c71cc99d2fc1c12a3d3e1b27e448ca612a89a1d-package.json into cache
Adding VCS repository bower-asset/bootstrap
Downloading https://api.github.com/repos/twbs/bootstrap
Downloading https://api.github.com/repos/twbs/bootstrap/contents/bower.json?ref=master
Downloading https://api.github.com/repos/twbs/bootstrap/commits/master
Downloading https://api.github.com/repos/twbs/bootstrap/tags?per_page=100
Downloading https://api.github.com/repos/twbs/bootstrap/git/refs/heads?per_page=100
[UnexpectedValueException]
Could not parse version constraint <=2.*: Invalid version string "2.*"
Exception trace:
() at phar:///usr/bin/composer.phar/src/Composer/Package/Version/VersionParser.php:461
Composer\Package\Version\VersionParser->parseConstraint() at phar:///usr/bin/composer.phar/src/Composer/Package/Version/VersionParser.php:257
Composer\Package\Version\VersionParser->parseConstraints() at phar:///usr/bin/composer.phar/src/Composer/Package/Loader/ArrayLoader.php:234
Composer\Package\Loader\ArrayLoader->parseLinks() at phar:///usr/bin/composer.phar/src/Composer/Package/Loader/ArrayLoader.php:123
Composer\Package\Loader\ArrayLoader->load() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:174
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->preInitBranchPackage() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:138
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->initBranches() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:45
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->initialize() at phar:///usr/bin/composer.phar/src/Composer/Repository/ArrayRepository.php:178
Composer\Repository\ArrayRepository->getPackages() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:104
Composer\DependencyResolver\Pool->addRepository() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/Util.php:60
Fxp\Composer\AssetPlugin\Repository\Util::addRepositoryInstance() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/Util.php:39
Fxp\Composer\AssetPlugin\Repository\Util::addRepository() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AbstractAssetsRepository.php:139
Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository->whatProvides() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:199
Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:188
Composer\DependencyResolver\Pool->whatProvides() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:161
Composer\DependencyResolver\RuleSetGenerator->whitelistFromPackage() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:273
Composer\DependencyResolver\RuleSetGenerator->whitelistFromJobs() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:324
Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Solver.php:177
Composer\DependencyResolver\Solver->solve() at phar:///usr/bin/composer.phar/src/Composer/Installer.php:505
Composer\Installer->doInstall() at phar:///usr/bin/composer.phar/src/Composer/Installer.php:230
Composer\Installer->run() at phar:///usr/bin/composer.phar/src/Composer/Command/UpdateCommand.php:140
I don't think this is my mistake, but how do I fix the exception?
Michael Nguyen's answer did not work for me, but updating to dev-master did:
php composer.phar global require "fxp/composer-asset-plugin:dev-master"
One may also need to update composer itself:
php composer.phar self-update
Also there was an extensive discussion on this yesterday: link.
UPDATE. It seems to me at this moment "fxp/composer-asset-plugin:1.0.*#dev" is better again.
I have the same issue and discussed on Yii Forum. It seems like this is a bug with "fxp/composer-asset-plugin".
Try
php composer.phar global require "fxp/composer-asset-plugin:1.0.1"
Then do whatever you need with composer
The bug is discussed at https://github.com/francoispluchino/composer-asset-plugin/issues/129
It helped for me
composer self-update
composer global update

Resources