douwen1937 2019-06-14 18:01
浏览 359

通过Composer安装或更新symfony / flex会无声地失败

I have a project using symfony/flex in which I cannot run composer install or composer update. I also can't create a new composer project with symfony/flex as a dependency as the failure is the same. For example;

mkdir foo && cd foo && composer require symfony/flex -vvv

Always has the following output;

...
Package operations: 1 install, 0 updates, 0 removals
Installs: symfony/flex:v1.2.6
  - Installing symfony/flex (v1.2.6): Reading /Users/me/.composer/cache/files/symfony/flex/17b622276922e6347ea129acd6238ae1c41d96b6.zip from cache
Loading from cache
 Extracting archiveExecuting command (CWD): unzip -qq  '/Users/me/projects/foo/vendor/symfony/flex/2064a553f7cdf064ba8c1b62c7087ec6' -d '/Users/me/projects/foo/vendor/composer/65215880'
Loading plugin Symfony\Flex\Flex
Downloading https://flex.symfony.com/versions.json

The download hangs for a few seconds at the point of downloading versions.json before silently failing. vendor/symfony/flex exists.

What could be the cause of this failure? My colleague can run the same command successfully so I'm assuming an issue with my local composer. I have attempted reinstall composer and clearing the cache with no success.

Edit: now when running composer update -vvv in an existing project I get the following output

...
Downloading https://repo.packagist.org/packages.json

Where it also hangs, so it looks like composer cannot download certain JSON files? Packages download fine so it doesn't look like a lack of internet.

Edit 2: I can also confirm using composer update --no-plugins does work within the existing project.

  • 写回答

2条回答 默认 最新

  • douzhicai7148 2019-06-14 18:44
    关注

    When composer isn't working as expected, you should reset it and update it like this. First

    $ composer clearcache
    

    Then update

    $ composer self-update
    

    Then run a diagnostic

    $ composer diagnose
    

    Then cd to where you have composer.json located and do

    $ composer dump-autoload
    

    Then

    $ composer install
    

    Should fix this issue. Another approach includes

    $ composer update symfony/flex --no-plugins --no-scripts
    

    Also, this can arise due to a conflict between symfony/flex and symfony/symfony. To remove that conflict follow these steps

    $ composer remove symfony/symfony
    

    then edit your composer.json file like

    {
        "require": {
            "symfony/flex": "^1.0",
         },
         "conflict": {
             "symfony/symfony": "*"
        }
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料