Symfony2 : --reinstall issue - php

I have been trying to install Buzz for Symfony2. I added it to the deps file, and tried to update my vendors :
php bin/vendors update
The command simply tells me that I've installed the standard version, and that I should try to use :
php bin/vendors install --reinstall
instead. Which I did.
But then an error pops in and tells me :
Updating deps.lock
sh:/var/www/Symfony/vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php: not found
PHP Fatal error: Class 'Doctrine\Common\Annotations\AnnotationRegistry' not found in /var/www/Symfony/app/autoload.php on line 37
PHP Fatal error: Class 'Doctrine\Common\Annotations\AnnotationRegistry' not found in /var/www/Symfony/app/autoload.php on line 37
And then nothing works anymore, which is not surprising because my vendors folder is almost empty.
Has anyone encountered this problem before? Any clue on how to fix it?
Edit :
I found out the origin of this error. I didn't have git installed, so I did :
sudo apt-get install git-core
Check this link for more info on that : http://comments.gmane.org/gmane.comp.php.symfony.symfony2/8239
However I'm having another error now ("Looked for namespace "buzz.client.curl", found none"). I'm making another thread for that one, as it is not the same problem (link here).

That's not the right way to update your vendors. Per the docs
There is also a php bin/vendors update command, but this has nothing
to do with upgrading your project and you will normally not need to
use it. This command is used to freeze the versions of all of your
vendor libraries by updating them to the version specified in deps and
recording it into the deps.lock file.
Ergo, all you need to do is run php bin/vendors install (I know, it's confusing. I partially blame them for poorly naming the sub-command)
EDIT
To help resolve your current issues, try these steps
rm -rf vendor/*
rm -rf app/cache/*
rm app/bootstrap.php.cache
php bin/vendors install
Hope it works

Try to remove everything from "vendor" folder and run
php bin/vendors install
command

Before you add in deps file copy all the content of deps file in any of your text editor,then delete all your contents of deps and add the Buzz link in deps only.
Then try the below command
php bin/vendors install --reinstall
this will install the BUZZ bundle safely. After installing BUzz bundle you can paste all the deps content that you have copied earlier.
If you are trying this make sure to download new symfony project and try this.
May be this will helps you. I tried it earlier on one of my project.

Related

Laravel composer install giving error "Your lock file does not contain a compatible set of packages please run composer update"

I have been writing laravel code for quite sometime. Currently, I tried cloning a project from github and editing locally. I installed composer in my project directory but a vendor folder was not included, I tried to run composer install but I gives me this error
Your lock file does not contain a compatible set of packages. Please run composer update
How do I resolve this?
Note: I have tried running composer update on previous clones and that didn't work.
Run this command:
composer install --ignore-platform-reqs
or
composer update --ignore-platform-reqs
Disclaimer, this solution will not fix the issue for PHP 8 projects.
In most cases this happens because of PHP 8 (In my case it was GitHub CI actions automatically started using PHP 8 even though my project is php 7.4)
If you have multiple PHP installations (E.g. 7.4 and 8 on the same server), this is how you can fix it.
Specify your php version in your composer.json file
"config": {
"platform": {
"php": "7.3"
}
},
If you have the lock file already committed, run composer update after you adding above line in to the composer.json and then commit the new lock file. (Please be aware composer update will upgrade your packages to latest versions)
I solved this problem with this command:
composer self-update --1
It probably works because at time that the project was developed, composer was on another version and when change the Major version from 1 to 2 the compatibility was broke. With this command you downgrade composer and probably going to solve this
You should try running composer update --lock that will update all packages and recreate the compose.lock file.
Either you can delete the composer.lock file and run composer install that will also recreate the .lock file.
This resolved my issue.
I had this error with Github Actions trying to deploy a Laravel app, this is probably different than the OP's case but none of the suggestions worked for me. Adding my answer here just in case there is someone else out there with a similar problem to mine.
I had to disable -q in Github Actions and see that it was complaining about extensions not being installed.
Make sure your require section of composer's php extensions matches the extensions: in your github action file for shivammathur/setup-php#v2 and it will deploy again
Recently I've just come across of this error when I tried to run my Laravel 7 project which required php v7.* with php v8. As I forgot my php version I just tried bunch of composer command, but just got error after error.
Anyway, to solve this just downgrade/upgrade php version as required. Just search how to do that in youtube.
you can see your project required php version in composer.json file (just if you wonder)
Also you can try following way (But though it didn't worked for me, seems it helped quite some people)
-- Open composer.json file and change php version to something like this: "php": "^7.3|^8.1"
-- Then run composer update
I faced this problem with my cakephp project in garuda linux (arch based)
Fix :
Install php-intl using sudo pacman -S php-intl
Enable php intl by editing php config ( in my case /etc/php/php.ini ) .
add extension=intl or uncomment the existing one
restart apache or whatever you are using
I had the same error deploying another project with composer, but the problem was a missing php extension.
I understand you solve your problem but for anyone seeing the same error message, here is a general guidance :
The error message Your lock file does not contain a compatible set of packages. Please run composer update is shown each time there is a conflict during the dependency solving step of composer install. (see the relevant part in composer source code)
It doesn't inform on the real problem though, and it could be hard to guess.
To get the exact explanation you can add --verbose option to composer install command (the option is available to any composer command (see the doc)) : composer install --verbose
It will give you the full message explaining what exactly is preventing composer install from completing (package version conflict, missing php extension, etc.), then you'll be able to fix the problem.
Hope this could help.
In my case this problem is occuring in Ubuntu 20.04 Desktop. This is due to some missing packages.
I ran the following commands to install some packages then rerun Composer install and its working properly. The commands are:
sudo apt-get install php-mbstring
sudo apt-get install php-xml
Then rerun composer install

Not able to install symfony on windows

Hello I am trying to install symfony on Windows. I had follow the all require steps for it but it end up with below message.
[RuntimeException]
Symfony can't be installed because the downloaded package is corrupted.
To solve this issue, try executing this command again:
Symfony new demo 3.2.8
When i tried above command it says :
'symfony' is not recognized as an internal or external command,
operable program or batch file.
I have try to reinstall composer and Symfony package both but it does not resolve the issue. It stays the same issue again.
Please help me how can I install it on Windows.
You are required to make it run through PHP as its a script file.
This gets the installer (which it looks like you have already)
php -r "readfile('https://symfony.com/installer');" > symfony
Then php symfony new demo 3.2.8 (asuming if php is in path otherwise you have to specify the php.exe path too)
For the full details see http://symfony.com/doc/current/setup.html
Regards
forget about that installer use composer from command line
composer create-project symfony/framework-standard-edition my_project_name
BTW i don't know what server you are using (wamp/xamp etc), i recomending this
https://laragon.org/
it have composer and all tools that you need to start with symfony

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

What can I do to fix this error when attempting to install active record for composer from github?

I create a JSON file called composer.json with
{
"require":{"php-activerecord/php-activerecord": "dev-master"}
}
I then go to the folder in Terminal and type: composer install
I receive this fail message:
[RuntimeException]
Failed to clone https://github.com/kla/php-activerecord.git, git was not found, check that it is installed a
nd in your PATH env.
sh: git: command not found
I have no idea what to do. Any help would be great.
Your system does not find the command line command git.
Your options:
Install git for the command line.
Don't install "dev-master" of that library, but a tagged version instead.
The first one will make it work in general. The second one will avoid using git to download the source code, but a ZIP file of that version.

Symfony2 + DoctrineFixtureBundle : .git/info/refs not found

I have a fatal error, when updating my current symfony 2 version (from 2.0.12 to 2.0.15).
Here the error:
> Installing/Updating doctrine-fixtures
HEAD is now at bed8908 Update README.md
> Installing/Updating DoctrineFixturesBundle
fatal: https://github.com/symfony/DoctrineFixturesBundle.git/info/refs not found: did you run git update-server-info on the server?
PS: I have done the git update-server-info command. But nothing...
Here my deps file
[doctrine-fixtures]
git=http://github.com/doctrine/data-fixtures.git
[DoctrineFixturesBundle]
git=http://github.com/doctrine/DoctrineFixturesBundle.git
target=bundles/Symfony/Bundle/DoctrineFixturesBundle
version=origin/2.0
and my deps.lock file
doctrine-fixtures bed8908ae929562317e5c59dc0bee24f3b63067e
I noticed the same thing today.
The key thing to note is that the issue relates to DoctrineFixturesBundle (note /symfony and not /doctrine)
If you check the latest change to the 2.0 Branch you'll see they've changed it to point to the correct repository.
I had to end up deleting the bundles/Symfony/Bundle/DoctrineFixturesBundle from my vendors directory and re-ran php bin/vendors install.
I can now run bin/vendors install without it throwing the fatal.
You have to update your deps file.
Change:
[DoctrineFixturesBundle]
git=http://github.com/symfony/DoctrineFixturesBundle.git
target=/bundles/Symfony/Bundle/DoctrineFixturesBundle
Into:
[DoctrineFixturesBundle]
git=http://github.com/doctrine/DoctrineFixturesBundle.git
target=/bundles/Symfony/Bundle/DoctrineFixturesBundle
Then, run:
bin/vendors install
It should install only missing bundles.
I have found the solution:
Thanks to previous answer, remove DoctrinerFixtureBundle into your repository
Secondly, run php bin/vendors reinstall
The reinstall vendors will be the command which makes the difference into my case...

Categories