zoukankan      html  css  js  c++  java
  • composer安装依赖时报错的处理办法

    近段时间经常跟composer打交道,在中间也遇到了很多的坑,这里总结一下

    目录

    0x01 安装时composer出现Killed,被终止

    0x02 出现“Your requirements could not be resolved to an installable set of packages.”

    在使用下面命令对composer.json进行安装的时候,经常会出现下面的两种种问题。

    composer install
    

    0x01 安装时composer出现Killed,被终止

    情况可能是下面这个样子的

    file

    这种情况是由于缓存不足而造成的,在Linux中我们可以增加缓存来解决这个问题。

    file

    free -m
    mkdir -p /var/_swap_
    cd /var/_swap_
    dd if=/dev/zero of=swapfile bs=1M count=2000
    mkswap swapfile
    swapon swapfile
    echo "/var/_swap_/swapfile none swap sw 0 0" >> /etc/fstab
    free -m
    

    0x02 composer出现“Your requirements could not be resolved to an installable set of packages.”

    这种报错的情况一般是这样子的

    file

    file

    它虽然出现了"Your requirements could not be resolved to an installable set of packages.","You can also run php --ini inside terminal to see which files are used by PHP in CLI mode."这两种提示,但是这个不是我们所要关注的重点。

    我们需要关注的是中间Problem提示了哪些内容

    比如下面这个情况

    file

    在这种情况下,我们仅仅只需要安装php所对应的gd就可以解决这个报错了。

    这里我用Ubuntu为例来说明,如果你安装的是php7.0的,即使用下列命令进行安装的

    apt-get install php7.0
    

    这个时候需要运行下列命令就可以安装了,就可以解决这个问题了

    apt-get install php7.0-gd
    

    下面这个例子也是一样的解决办法

    file

    apt-get install php7.0-mbstring
    

    如果安装的是php7.2,这里改一下版本就可以了

    apt-get install php7.2-mbstring
    

    文章首发公众号:无心的梦呓(wuxinmengyi)

    这是一个记录红队学习、信安笔记,个人成长的公众号

    扫码关注即可

    file

  • 相关阅读:
    课程设计第八天,8.26
    课程设计第七天,08.25
    赖世雄英语
    英语语法-小学
    CSS(Cascading Style Sheet)
    Coredraw x7
    Servlet
    团队作业4——第一次项目冲刺(Alpha版本)2017.11.18
    团队作业4——第一次项目冲刺(Alpha版本)2017.11.16
    团队作业4——第一次项目冲刺(Alpha版本)2017.11.14
  • 原文地址:https://www.cnblogs.com/wuxinmengyi/p/11614963.html
Copyright © 2011-2022 走看看