Fixed: Cannot install sample data in Magento 2, even with authentication keys stored in auth.json

If you’ve tried installing the Magento 2 sample data using the CLI tool, you may get the following message:

# sudo bin/magento sampledata:deploy
./composer.json has been updated
Loading composer repositories with package information

[Composer\Downloader\TransportException]
The 'https://repo.magento.com/packages.json' URL required authentication.
You must be using the interactive console to authenticate

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [packages1] ... [packagesN]

There is an error during sample data deployment.

The solution documented on the Magento 2 Developer hub is to switch to your Magento 2 base directory and run composer update, which will ask for your Magento Connect authentication keys and then store them for you in your ~/.composer/auth.json file.

What happens, however, when you’ve already done that and you still get the same error? Well then you have to start doing your research, which will bring you to this bug report.

Since I cloned from master and the bug has only been fixed in develop (as of this writing), the only solution if you want to install the sample data is to manually apply the patch referenced in the bug report yourself.

Once that was done, sample data installation proceeded with no problems.

One thought on “Fixed: Cannot install sample data in Magento 2, even with authentication keys stored in auth.json”

Leave a Reply

Your email address will not be published. Required fields are marked *