码迷,mamicode.com
首页 > 其他好文 > 详细

使用composer遇到的问题及解决方法

时间:2018-02-22 21:38:09      阅读:11699      评论:0      收藏:0      [点我收藏+]

标签:etc   been   could not   一个   highlight   error   情况   https   red   

  可以尝试利用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.

  需要安装一个插件(plug),运行命令安装即可:

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中找。

使用composer遇到的问题及解决方法

标签:etc   been   could not   一个   highlight   error   情况   https   red   

原文地址:https://www.cnblogs.com/-beyond/p/8459958.html

(2)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!