Composer update "could not completely remove doctrine/dbal", Laravel 4 broken - php

I just did a Composer update on my Laravel 4 project, after which it completely broke down. It all started with Composer giving me the error "Could not completely remove doctrine/dbal", after which I tried the update again.
At that point the Artisan command php artisan clear-compiled, set to run before a Composer update, failed, saying the redirectIfTrailingSlash() method (called in bootstrap/start.php) does not exist.
So now my app is giving me the white screen of death, and Composer update/install can't fix it. I've tried removing the lock file and all packages in vendor. No dice.
More info:
I have no compiled.php file in the bootstrap folder. Artisan probably removed this before the first update that made everything fail.
My composer.json works, I have updated without trouble many times before.
I can run Composer if I use --no-scripts or comment out the redirectIfTrailingSlash() method call.
When I run composer update successfully, I get a lot of suggested packages to install, doctrine/dbal being among those. A successful composer update doesn't solve my problem, however.
The initial composer update was run from my development VM. I have no idea why it would have trouble removing packages, though.
Any help is welcome.

Did you try upgrading Laravel as there is no need for redirectIfTrailingSlash(). If so read the upgrade process here github.com/laravel/laravel/blob/develop/upgrade.md
If not then the Laravel package is not installing fully/at all.
Turns out the comment was the solution.

These commands should help:
composer remove doctrine/dbal will solve the problem.
composer remove packagename removes package.

Related

"vendor" folder missing after running "Composer Install"

I am currently trying to run on Vagrant/Homestead a Laravel Application that I pulled from Github. I connected it to the database, and run Composer Install, Composer Update inside the folder. When I try to access to it on the Browser I get the following error:
Warning: require(/home/vagrant/.../public/vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/..../public/autoload.php on line 2
I navigated to the vendor folder and noticed that it was not created. Any ideas how to fix it?
The application runs in Laravel 4, and I got the following output from the terminal when I run Composer Install:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package herrera-io/json is abandoned, you should avoid using it. Use kherge/json instead.
Package kherge/version is abandoned, you should avoid using it. No replacement was suggested.
Package herrera-io/phar-update is abandoned, you should avoid using it. No replacement was suggested.
Package mjolnic/bootstrap-colorpicker is abandoned, you should avoid using it. Use itsjavi/bootstrap-colorpicker instead.
Generating autoload files
php artisan clear-compiled
php artisan optimize
Generating optimized class loader
Any ideas?
Composer needs to be run from the root of your application, i.e. not from the public folder as your error seems to indicate.
You can first try running:
composer install --no-scripts
This command should list the packages that are being downloaded and installed. If the above works, you can then run:
php artisan optimize
This will create the autoload.php file that Laravel will use.
I also experienced that, i solved the problem by creating a vendor/bin folder inside the Composer directory.
$PATH/users/*-system_name-*/AppData/Roaming/Composer
I got the same problem, some answer are valid but didnt help then i tried a command = composer dump-autoload. Then it works fine. HOPE this helps you the best.

Fatal error: Class 'Illuminate\Foundation\Application' not found

I am getting following error when I open my site which is made using laravel 5
Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\cms\bootstrap\app.php on line 14
I have tried removing vendor folder and composer.lock file and running composer install it's not working I tried running PHP artisan optimize but it shows error
Fatal error: Class'Illuminate\Foundation\Application' not found
Is there any way to solve this problem?
Edited:
This problem aroused as soon as I used the php artisan make:model Page command which did create the model but then the above error gets displayed when I access the site
Also If use the Laravel's Local Development Server no such problem arises only if I use wamp server
In my situation, I didn't have the full vendor dependencies in place (composer file was messed up during original install) - so running any artisan commands caused a failure.
I was able to use the --no-scripts flag to prevent artisan from executing before it was included. Once my dependencies were in place, everything worked as expected.
composer update --no-scripts
Just in case I trip over this error in 2 weeks again...
My case: Checkout an existing project via git and pull in all dependencies via composer. Came down to the same error listed within the title of this post.
Solution:
composer dump-autoload
composer install --no-scripts
make sure everything works now as expected (no errors!)
composer update
Something is clearly corrupt in your Laravel setup and it is very hard to track without more info about your environment. Usually these 2 commands help you resolve such issues
php artisan clear-compiled
composer dump-autoload
If nothing else helps then I recommend you to install fresh Laravel 5 app and copy your application logic over, it should take around 15 min or so.
Easy as this, that worked for my project
Delete /vendor folder
and execute composer install
then run project php artisan serve
In my case composer was not installed in that directory. So I run
composer install
then error resolved.
or you can try
composer update --no-scripts
cd bootstrap/cache/->rm -rf *.php
composer dump-autoload
I just fixed this problem (Different Case with same error),
The answer above I tried may not work because My case were different but produced the same error.
I think my vendor libraries were jumbled,
I get this error by:
1. Pull from remote git, master branch is codeigniter then I do composer update on master branch, I wanted to work on laravel branch then I checkout and do composer update so I get the error,
Fatal error: Class 'Illuminate\Foundation\Application' not found in
C:\cms\bootstrap\app.php on line 14
Solution:
I delete the project on local and do a clone again, after that I checkout to my laravel file work's branch and do composer update then it is fixed.
I had accidentally commented out:
require __DIR__.'/../bootstrap/autoload.php';
in
/public/index.php
When pasting in some debugging statements.
For latest laravel version also check your version because I was also
facing this error but after update latest php version, I got rid from
this error.
run composer require laravel/framework after composer install then php artisan key:generate its work for me in kali linux
I can't imagine that anyone else reading this is a stupid as I was but just in case...
I had accidentally removed "laravel/framework": "^5.6" from my composer.json when resolving merge conflicts.
please test below solution:
first open command prompt cmd ==> window+r and go to the location where laravel installed.
try composer require laravel/laravel
i was having same problem with this error.
It turn out my Kenel.php is having a wrong syntax when i try to comply with wrong php8 syntax
The line should be
protected $commands = [
//
];
instead of
protected array $commands = [
//
];
#kalhan-toress 's comment is what ACTUALLY WORKED FOR ME
remove /bootstrap/start.php,composer.lock, and the vendor and run composer install
In my case, the error was caused on initial deployment because I didn't have a .env file in that directory (because those don't belong on Github where the files were transferred from).
check your .env file i think you miss something. Maybe like this
if yes then need to add manually and composer update or install composer

Composer Update Laravel

A developer has sent me his project to work with, but when ever I try to update or install my vendors everything works great until the very end and it outputs the message bellow.
C:\xampp\htdocs\BigWaveMedia\davinkit>php artisan migrate
{
"error": {
"type": "Exception",
"message": "expected color value: failed at `.clearfix;` C:\\xampp\\htdocs\\BigWaveMedia\\davinkit\\app\\start\/..\/..\/public\/less\/style.less on line 102",
"file": "C:\\xampp\\htdocs\\davinkit\\vendor\\leafo\\lessphp\\lessc.inc.php",
"line": 3258
}
}
C:\xampp\htdocs\BigWaveMedia\davinkit>
Any ideas at all? Here is a full log http://pastebin.com/y9q4Rc5z
When you run composer update, composer generates a file called composer.lock which lists all your packages and the currently installed versions. This allows you to later run composer install, which will install the packages listed in that file, recreating the environment that you were last using.
It appears from your log that some of the versions of packages that are listed in your composer.lock file are no longer available. Thus, when you run composer install, it complains and fails. This is usually no big deal - just run composer update and it will attempt to build a set of packages that work together and write a new composer.lock file.
However, you're running into a different problem. It appears that, in your composer.json file, the original developer has added some pre- or post- update actions that are failing, specifically a php artisan migrate command. This can be avoided by running the following: composer update --no-scripts
This will run the composer update but will skip over the scripts added to the file. You should be able to successfully run the update this way.
However, this does not solve the problem long-term. There are two problems:
A migration is for database changes, not random stuff like compiling assets. Go through the migrations and remove that code from there.
Assets should not be compiled each time you run composer update. Remove that step from the composer.json file.
From what I've read, best practice seems to be compiling assets on an as-needed basis during development (ie. when you're making changes to your LESS files - ideally using a tool like gulp.js) and before deployment.
The following works for me:
composer update --no-scripts
this is command for composer update please try this...
composer self-update
write this command in your terminal :
composer update
You can use :
composer self-update --2
To update to 2.0.8 version (Latest stable version)

Laravel error in /bootstrap/start.php: \Illuminate\Foundation\Application not found

So, I installed Laravel on a dev server (php5.5.3, standard installation, mcrypt installed), and I get the following error message:
Fatal error: Class 'Illuminate\Foundation\Application' not found in /[path_to_laravel_app]/bootstrap/start.php on line 14
Quite odd, and I haven't seen a solution to this file, although I've seen plenty of similar errors. Any advice welcome. Thanks!
/bootstrap/start.php is created after composer install by running Laravel's php artisan optimize. I've had a lot of issues on this during upgrades of Laravel, but removing /bootstrap/start.php, composer.lock, and the vendor directory and re-running composer install should fix this issue.
Run this command:
composer update --no-scripts
In my case I have added another required package(Guzzle) in the compser.json file separately(in the last line but it should be after the laravel package line) and updated the compsoser and came across this issue.
I have checked and my vendor/laravel folder has gone. That was preventing me to run any artisian command.
So "--no-scripts" worked for me as it prevents any scripts to be included before executing artisan.
You can use another method in case you are having issues.
Install another raw laravel and copy all the files from the vendor
file to your old repostory.
Change permission of storage and bootstrap folder to 775 or 777.
Delete everything in the session and view folder of storage/framework
Correct the composer.json. This might happen after you have added a new package configuration by dublicating the require tag.
Do not create yet another
require: {
..
}
use the previous defined one.
Then follow the accepted answer to re-install the packages.
Just Run the command
composer install --no-scripts
Or,
composer update --no-scripts
Double check your composer.json file. If you have error on "require": section this error will occur.
Just restore a previous version of composer.json file and run composer update.

What if I don't want to do composer update, I just want to use what ever in composer.json and composer.lock

I have an old composer based symfony project, that I just updated with some changes of code. I tested in development everything works fine. I have got issue when deploying the composer asked to run composer.phar self-update to update the composer since the composer is outdated. After that I do the composer.phar install. I get this error -
[RuntimeException]
Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.
What if I don't want to update. I am okay this. How can I force it not to update.
The structure of the lock file was changed, and therefor you should upgrade your lock file. You can upgrade your lock file without actually upgrading any dependencies by executing:
composer update nothing
I would suggest you look at the composer.lock file and note any versions that are used there. Then copy these into the composer.json, delete the lock file and run a normal install.
Of course, you do this on a copy of your software to see if all the same versions do appear again.

Categories