How to update composer on windows? - windows

If I run composer then I get:
Warning: This development build of composer is over 60 days old. It is
recommended to update it by running
"C:\ProgramData\ComposerSetup\bin\composer.phar self-update" to get
the latest version
However, if I run the command C:\ProgramData\ComposerSetup\bin\composer.phar self-update then the following window appears, which says that the file could not be opened:

Try
php C:\ProgramData\ComposerSetup\bin\composer.phar self-update

I just figured out that I could also just execute
composer selfupdate
or
composer self-update

try Also:
composer update
it should run

I run the below commands and it worked for me, so my composer version is 1.10.20 to 2.0.9
php C:\ProgramData\ComposerSetup\bin\composer.phar self-update
composer self-update --2

Related

Not able to install codeception on MacBook using composer

I have a MacBook with Catalina 10.15.6
I have PHP and Composer installed.
I use the command composer require "codeception/codeception" --dev
And it just sits and waits.
what are we waiting for?
You executed some other composer application that you had installed in your system.
To use composer.phar file you have to execute it with PHP php composer.phar require "codeception/codeception" --dev or make it executable and run ./composer.phar require "codeception/codeception" --dev

Class 'BeyondCode\DumpServer\DumpServerServiceProvider' not found when I make composer install --optimize-autoloader --no-dev

I'm deploying my Laravel application and want to optimize the autoload, normally I would run the command
composer install --optimize-autoloader --no-dev
This is an application that runs Laravel 5.8. I am getting the following error:
In Application.php line 662:
Class 'BeyondCode\DumpServer\DumpServerServiceProvider' not found
Script #php artisan package:discover --ansi handling the
post-autoload-dump event returned with error code 1
If you do not have development dependencies on the laravel-dump-server, remove the following line from composer.json.
"beyondcode/laravel-dump-server": "^1.0".
Then run the following command.
composer install
Or, even easier, just run the following.
composer remove --dev beyondcode/laravel-dump-server
In my case I have done below steps
Delete vendor folder
Run: composer self-update --1
And again run: composer install
Then you can run any command you want
A detail around this issue has been written in one of the GitLab issues on
https://github.com/GoogleCloudPlatform/php-docs-samples/issues/736
This issue explain why this dev package creates problem on your build server.
For me, The issue resolved after I've added this in composer.json
{
"scripts": {
"gcp-build": [
"composer install --no-dev"
]
}
}
This will remove all the dev dependencies
I simply do
composer update
and then I redo again
like myself I run
php artisan migrate
Solution 1
composer install --optimize-autoloader --no-dev
if this not work try and getting error undefine index: Name
Solution 2
Step1: `composer self-update --1`
Step2: composer install
Bingo...!!!
You may need to run composer update with the --no-plugins option.
composer update --no-plugins

Class 'Illuminate\Database\MySqlConnection' not found error in laravel 5.2

While loading the dynamic page in laravel 5.2 I am getting below error.
FatalThrowableError in ConnectionFactory.php line 217:
Class 'Illuminate\Database\MySqlConnection' not found
what might be the issue.how to solve these I have tried below commands none of these helped to rectify the above issue.
composer dump-autoload
php artisan cache:clear
php artisan route:cache
php artisan config:cache
For me deleting the vendor directory and re-running composer install fixed this problem.
Just do a sudo rm -R vendor in your projects directory followed by a composer install and everything should work.
I am not using Laravel 5.2 but 5.7.28 instead. I followed #jgleesti's solution deleting the vendor folder and re-running composer install. It made it better but didn't solve my problem. So I did some more steps to solve my issue.
sudo apt-get --purge remove php-common
sudo apt-get install php-common php-mysql php-cli php-bcmath
Not sure how, but it works for me.
I've got the same issue, it seems the PDO is not working on my site,
Tried to purge the PHP / MySQL
Reinstall PHP / MySQL
It seems that the module for pdo loaded from PHP – ini and PHP – m

how to upgrade version of composer

I was trying to require a package using composer require command, and I faced following error
your version of
Composer is too old Please upgrade using https://getcomposer.org/
How can I update composer itself?
I am using Linux Mint 18.3.
Use this command to update the version of composer:
composer self-update
It's now new version of composer. So anyone want to upgrade the composer, should use this command:
composer self-update --2
The best way is using this command: composer self-update --stable
//To Update Composer try
composer self-update --2

Swiftmailer Error Composer Install

i am installing composer dependencies by 'composer install'.
it download bunch of packages but after swiftmailer it gives me error
[UnexpectedValueException]
'C:\Users\DELL\Downloads\laravel-4\vendor/swiftmailer/swiftmailer/72e34d......54c82f.1' is not a zip archive.
what does it mean?
For me this problem happened due to the order composer was installing the files.
The work around that worked for me was to go into \vendor\composer\autoload_real.php and comment out the following line
require $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php';
and then run composer again
Running composer install with the --prefer-source option, fixed this problem for me.

Resources