composer update删除第三方库的问题

YII2项目使用的composer.json存在问题,之前通过composer装的库都被删掉了,大概长这样(composer.json内没有require的key):

{
    "config": {
        "secure-http": false
    },
  "autoload":{
    "psr-4":{"Mq\\Rabbitmq\\":"vendor/mq/rabbitmq/src/","ZLog\\":"vendor/log/zlog/src/"}
  }
}

导致执行composer require安装新库或者composer update更新时会把vendor文件夹里面所有的库都删掉,解决办法是通过composer info找回之前装的库以及版本:

composer update删除第三方库的问题_第1张图片
image.png

把这些信息重新写回composer.json,新的composer.json长这样:

{

    "config": {
        "secure-http": false
    },
  "autoload":{
    "psr-4":{"Mq\\Rabbitmq\\":"vendor/mq/rabbitmq/src/","ZLog\\":"vendor/log/zlog/src/"}
  },
  "require": {
    "cebe/markdown":"1.1.1",
    "ezyang/htmlpurifier":"v4.6.0",
    "google/apiclient":"v1.1.8",
    "guzzlehttp/guzzle":"6.3.0",
    "guzzlehttp/promises":"v1.3.1",
    "guzzlehttp/psr7":"1.4.2",
    "phpspec/php-diff":"v1.1.0",
    "psr/http-message":"1.0.1",
    "yiisoft/yii2":"2.0.6",
    "yiisoft/yii2-bootstrap":"2.0.6",
    "yiisoft/yii2-composer":"2.0.5",
    "yiisoft/yii2-debug":"2.0.7",
    "yiisoft/yii2-gii":"2.0.5",
    "yiisoft/yii2-redis":"2.0.5",
    "mongodb/mongodb": "^1.4"
  }
}

此时还是报错,执行

composer global require "fxp/composer-asset-plugin:1.*"

问题解决。

你可能感兴趣的:(composer update删除第三方库的问题)