0

I got an outdated extension from Klarna. In order to update this extension, I need to first update my composer. How do I go about updating it. Tried self-update command, and it didn't work.

Running the command composer self-update -vvv threw the following error. How to fix it?

Reading ./composer.json
Loading config file /home/magento/.config/composer/config.json
Loading config file /home/magento/.config/composer/auth.json
Loading config file ./composer.json
Loading config file /home/magento/web/magento2.perfectmakeupmirrors.com/public_html/auth.json
Reading /home/magento/web/magento2.perfectmakeupmirrors.com/public_html/auth.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Failed to initialize global composer: Composer could not find the config file: /home/magento/.config/composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /home/magento/web/magento2.perfectmakeupmirrors.com/public_html/vendor/composer/installed.json
Loading plugin MagentoHackathon\Composer\Magento\Plugin
activate magento plugin
Loading plugin Magento\InventoryComposerInstaller\Plugin
Loading plugin Magento\ComposerRootUpdatePlugin\Plugin\PluginDefinition
Loading plugin Laminas\DependencyPlugin\DependencyRewriterPluginDelegator
Activating Laminas\DependencyPlugin\DependencyRewriterV1
Loading plugin Dealerdirect\Composer\Plugin\Installers\PHPCodeSniffer\Plugin
Running 1.9.3 (2020年02月04日 12:58:49) with PHP 7.4.13 on Linux / 4.15.0-50-generic
In Laminas\DependencyPlugin\DependencyRewriterV1::onPreCommandRun
Downloading https://getcomposer.org/versions
Updating to version 2.1.5 (stable channel).
Downloading https://getcomposer.org/download/2.1.5/composer.phar.sig
 Downloading https://getcomposer.org/download/2.1.5/composer.phar
Downloading (100%)
 [ErrorException]
 rename(/home/magento/.cache/composer/composer-temp.phar,/usr/bin/composer):
 Permission denied
Exception trace:
 () at phar:///usr/bin/composer/src/Composer/Command/SelfUpdateCommand.php:356
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 rename() at phar:///usr/bin/composer/src/Composer/Command/SelfUpdateCommand.php:356
 Composer\Command\SelfUpdateCommand->setLocalPhar() at phar:///usr/bin/composer/src/Composer/Command/SelfUpdateCommand.php:241
 Composer\Command\SelfUpdateCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:267
 Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:106
 Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:61
 require() at /usr/bin/composer:24
self-update [-r|--rollback] [--clean-backups] [--no-progress] [--update-keys] [--stable] [--preview] [--snapshot] [--set-channel-only] [--] [<version>]
asked Jul 12, 2021 at 15:36
1
  • Are you getting an error? What do you mean by it "didn't work"? Commented Jul 12, 2021 at 17:28

1 Answer 1

1

Check composer version using below command from Magento root.

composer -vvv about

You should see somewhere below line in the output.

Composer - Dependency Manager for PHP - version 2.x.x

If you see version 1.x.x then you might have to update composer by executing the composer self-update -vvv then make sure that project is using the composer 2.x.x version again by executing composer -vvv about

Finally to update klarna you can choose any of the methods.

composer update klarna/* -vvv

OR

Remove completely klarna and then do re-install the full Klarna meta package.

composer remove klarna/m2-payments -vvv
composer require klarna/m2-payments -vvv

Please note, this will install/upgrade following modules.

  • vendor/klarna/module-core
  • vendor/klarna/module-kp
  • vendor/klarna/module-kp-graph-ql
  • vendor/klarna/module-onsitemessaging
  • vendor/klarna/module-ordermanagement
answered Jul 13, 2021 at 4:04
6
  • Ran the command to find out what version my composer is. Below is the excerpt from the output. Loading plugin Dealerdirect\Composer\Plugin\Installers\PHPCodeSniffer\Plugin Running 1.9.3 (2020年02月04日 12:58:49) with PHP 7.4.13 on Linux / 4.15.0-50-generic Is my composer version 1.9.3? Commented Jul 14, 2021 at 9:48
  • Yes you have to update composer to 2.x Commented Jul 14, 2021 at 13:16
  • Sandip, please have a look at the error messages posted above. Commented Aug 8, 2021 at 18:16
  • oh that is permission denied issue, Composer is installed as a root, so you probably did that as root, try with sudo composer self-update -vvv Commented Aug 9, 2021 at 4:10
  • ok,. will try and update Commented Aug 9, 2021 at 7:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.