problem with composer on magento 2
-
23-12-2020 - |
Вопрос
I want to setup new extension with composer on magento2 and I get this error:
[Composer\Downloader\TransportException]
Invalid credentials for 'https://repo.magento.com/packages.json', aborting.
I use public key and private key as user and password ( get key from marketplace.magento.com
)
I use this comment for install new extension:
composer require mageplaza/composer require mageplaza/magento-2-seo-extension
Решение
I want you to try two things:
- Do you have more than one pair of public and private key enabled? If yes then try by enabling just one and disable all else.
Create auth.json:
To create
auth.json
:- Log in to your Magento server as, or switch to, the Magento file system owner.
Edit or create
auth.json
in the user’s home directory.The following example shows how to add repo.magento.com authentication to an existing file:
{ "github-oauth": { "github.com": "<your github oauth id>" }, "http-basic": { "repo.magento.com": { "username": "<public key>", "password": "<private key>" } } }
Source: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/dev_install.html#create-authjson
Другие советы
TLDR; => enter public key as Username and private key as Password
I get here with similar problem / refresh topic. I want to try install magento first time. Following this start guide
Using this composer command give me auth error:
create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <install-directory-name>
I registered to magento and i generate Api keys. But composer command was prompt for username so i try my user name which Magento generate for me, i tried my username and this public key and all this attempts ends with auth error.
Finnally i tried paste public key as Username and private key as Password and it works like a charm : )
Hope i help somebody