zoukankan      html  css  js  c++  java
  • composer安装扩展包异常

    我是tp5.1下,用composer安装扩展包,在命令行运行,无任何不反应,不下载也不报错,这时,我们先ctrl+c退出执行的命令,然后在tp5.1根目录下,找到composer.json文件,并用编辑器打开,在最后追加上如下内容:

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

    保存退出,然后在cmd命令行执行运行命令,就ok了。

    composer安装扩展包时,可以设置忽略版本匹配,命令如下:

    composer install --ignore-platform-reqs
    

    如果不知道扩展包的具体版本,可以写 * ,* 会下载最新的版本

    "require": {
        "topthink/think-helper":"*"
    },
    

    或者写 dev-master,dev-master作者也是很懵逼

    "require": {
        "topthink/think-helper":"dev-master"
    },
    

    再或者随便填写一个不存在的版本,cmd命令执行的时候,会报错,这时会提示该扩展包有哪些版本号,如作者填写的是 1.0 版本,当然这个版本执行的时候会报错并列出改扩展包都有哪些版本

      "require": {
        "topthink/think-helper":"1.0"
    },
    

    然后填写到composer.json文件里,然后在命令行进行执行 composer update,就会进行安装,ok了。

    安装报错

    错误如下:

    Your requirements could not be resolved to an installable set of   packages.
      Problem 1
          - overtrue/http 1.0.1 requires php >=7.0 -> your PHP version (5.6.34) does not satisfy that requirement.
          - overtrue/http 1.0.0 requires php >=7.0 -> your PHP version (5.6.34) does not satisfy that requirement.
          - overtrue/sendcloud 1.0.0 requires overtrue/http dev-master -> satisfiable by overtrue/http[dev-master] but these conflict with your requirements or minimum-stability.
          - overtrue/sendcloud 1.0.1 requires overtrue/http ^1.0 -> satisfiable by overtrue/http[1.0.0, 1.0.1].
          - Installation request for overtrue/sendcloud ^1.0 -> satisfiable by overtrue/sendcloud[1.0.0, 1.0.1].
    
    Installation failed, reverting ./composer.json to its original content.
    

    这是因为php版本不匹配,如下执行命令,进行忽略版本

    composer install --ignore-platform-reqs
    或者
    composer update --ignore-platform-reqs
    

    再次执行composer命令可以正常安装包了。

  • 相关阅读:
    Triangle
    Populating Next Right Pointers in Each Node II
    Populating Next Right Pointers in Each Node
    面试题之判断栈的入栈和出栈序列的合法性
    对称矩阵的压缩存储和输出
    栈的经典面试题之用两个栈实现一个队列
    C++的三大特性之一继承
    C++之类的析构函数
    malloc函数的底层实现你是否清楚
    【超详细教程】使用Windows Live Writer 2012和Office Word 2013 发布文章到博客园全面总结,再也不愁发博客了
  • 原文地址:https://www.cnblogs.com/daochong/p/11469376.html
Copyright © 2011-2022 走看看