zoukankan      html  css  js  c++  java
  • 使用composer遇到的问题及解决方法

      可以尝试利用composer下载Yii框架,编辑composer.json文件:

    {
        "require":{
            "yiisoft/yii2":"~2.0.0"
        }
    }
    

      然后在这个包含composer.json文件的目录下执行命令:

    composer install
    

      然后就等待下载完成

    问题零:Your requirements could not be resolved to an installable set of packages.

      如果出现下面这种情况:

    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Your requirements could not be resolved to an installable set of packages.
    

      需要安装一个composer资源插件,运行命令安装即可:

    composer global require "fxp/composer-asset-plugin:^1.4.1"
    

      

    问题一:proc_get_status() has been disabled for security reasons 

      如果出现下面这种情况:

    [ErrorException]
    proc_get_status() has been disabled for security reasons
    PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_get_status() has been disabled for security reasons'
    in phar:///usr/local/bin/composer/vendor/symfony/process/Process.php:1279
    

      这是因为安全原因,将proc_get_status函数禁用了,可以通过编辑php的配置文件php.ini,搜索proc_get_status,将他从disable_functions中删除即可。

    问题二:需要输入token

      如果是第一次使用composer,那么在下载文件yii框架的过程中,有几项需要输入token,如下图:

    [root@localhost tmp]# composer install
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    
    Could not fetch https://api.github.com/repos/jquery/jquery-dist, please create a GitHub OAuth token to go over the API rate limit
    Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+localhost.localdomain+2018-02-22+1945
    to retrieve a token. It will be stored in "/root/.composer/auth.json" for future use by Composer.
    Token (hidden):
    

      只要粘贴上面的URL到浏览器中打开,然后生成一个token,然后复制这个新的token,在命令行中需要token的地方输入该token即可,该token会存储在用户家目录/.composer/auth.json中:

    {
        "bitbucket-oauth": {},
        "github-oauth": {
            "github.com": "6ad4ef7375b1fb9........"},
        "gitlab-oauth": {},
        "gitlab-token": {},
        "http-basic": {}
    }
    

      此后可以不用再输入token了,composer会自动去auth.json中找。

  • 相关阅读:
    CentOS/Ubuntu安装最新的gcc-9
    CentOS 7 源码安装 CMake 3.16.2 最新稳定版。解决 cmake: command not found 问题
    堆排序
    linux可重入、异步信号安全和线程安全
    目录
    教程文档
    推荐文章
    学习文档
    开发工具-索引
    同步/异步/阻塞/非阻塞
  • 原文地址:https://www.cnblogs.com/-beyond/p/8459958.html
Copyright © 2011-2022 走看看