问题描述:

I cloned one of my local project and executed composer update but I am getting some error:

[Composer\Repository\RepositorySecurityException]

The contents of

http://packagist.org/p/friendsofsymfony/facebook-bundle$f1d8c88e21c3636c7d6d8d66f3e98ce2c83de942d1ab652f76e8c4f82e2c6363.js

on do not match its signature. This should indicate a

man-in-the-middle attack. Try running composer again and report this

if you think it is a mistake.

I also tried to clear composer cache but nothing is working.

Could someone give me an idea behind the issue so that it could be helpful for me.

Composer Version: b482ebe0ca18321d9322bd913af73c1c55adebf1

网友答案:

In my scenario, adding the following lines to composer.json fixed the issue.

"repositories": {
  "packagist": { "url": "https://packagist.org", "type": "composer" }
}

Edit

If you have more then one repository:

  "repositories": [
      { "type": "composer", "url": "https://packagist.org" },
      { "type": "git", "url": "[email protected]:repo_name/proj_name.git" }
  ],
网友答案:

For me, the solution was to shut down my firewall included in FortiClient, after that, all worked. The Firewall seems to be the "man in the middle" ;)

网友答案:

It happened to me when my internet connection was very unstable, that resulted in corrupted file. Do you have a "correct" connection ?

If your connection is right, try deleting your composer.lock file and removing everything what's in your vendor/ directory then do php composer.phar install.

网友答案:

Like @Javad said, the --prefer-dist should work.

I have used this for the following problem:

[Composer\Repository\RepositorySecurityException]
The contents of http://packagist.org/p/symfony/translation$452e624e2b8bf261
b553b79c0bfc170e5432455ebb33e9fbce585241a5fb7a16.json do not match its sign
ature. This should indicate a man-in-the-middle attack. Try running compose
r again and report this if you think it is a mistake.

This code has worked for me:

composer update --prefer-dist

It timeouts for quite some time, sometimes up to 15 minutes, but then it starts downloading.

网友答案:

By adding below code in composer.json file

"repositories": { "packagist": { "url": "https://packagist.org", "type": "composer" } }

For more info: http://tastytuts.net/php-tutorials/composer-update-man-middle-attack-error/

网友答案:

fix packagist repo as well with config option

composer config --global repo.packagist composer https://packagist.org
网友答案:

Following worked for me Update composer.json file with following , you will find that in users\Name of the user\AppData\Roaming\Composer

{
    "repositories": {
        "packagist": {
            "url": "https://packagist.org",
            "type": "composer"
        }
    }
}
相关阅读:
Top