composer报错:PHP Fatal error: Call to undefined method

新手提问 · jason571 · 于 7年前 发布 · 11835 次阅读

都不知道该用哪个版本的composer和哪个版本的fxp/composer-asset-plugin了,详细错误信息如下

PHP Fatal error:  Call to undefined method Fxp\Composer\AssetPlugin\Package\Version\VersionParser::parseLinks() in /home/jason/.composer/vendor/fxp/composer-asset-plugin/Repository/VcsPackageFilter.php on line 272

Fatal error: Call to undefined method Fxp\Composer\AssetPlugin\Package\Version\VersionParser::parseLinks() in /home/jason/.composer/vendor/fxp/composer-asset-plugin/Repository/VcsPackageFilter.php on line 272

补充信息

[jason@kali:/var/www/learn]$ composer -V
Composer version 1.0-dev (72cd6afdfce16f36a9fd786bc1b2f32b851e764f) 2015-12-28 17:35:19
[jason@kali:/var/www/learn]$ composer create-project yiisoft/yii2-app-advanced advanced 2.0.6
Installing yiisoft/yii2-app-advanced (2.0.6)
  - Installing yiisoft/yii2-app-advanced (2.0.6)
    Loading from cache

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

  Problem 1
    - Installation request for yiisoft/yii2 >=2.0.6 -> satisfiable by yiisoft/yii2[2.0.6].
    - yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
  Problem 2
    - yiisoft/yii2-bootstrap 2.0.5 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> no matching package found.
    - yiisoft/yii2-bootstrap 2.0.4 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> no matching package found.
    - yiisoft/yii2-bootstrap 2.0.3 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> no matching package found.
    - yiisoft/yii2-bootstrap 2.0.2 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> no matching package found.
    - yiisoft/yii2-bootstrap 2.0.1 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> no matching package found.
    - yiisoft/yii2-bootstrap 2.0.0 requires bower-asset/bootstrap 3.2.* | 3.1.* -> no matching package found.
    - Installation request for yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
[jason@kali:/var/www/learn]$ vi ~/.composer/composer.json 
[jason@kali:/var/www/learn]$ composer global require "fxp/composer-asset-plugin:1.0.0"
Changed current directory to /home/jason/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing fxp/composer-asset-plugin (v1.0.0)
    Loading from cache

PHP Fatal error:  Call to undefined method Fxp\Composer\AssetPlugin\Package\Version\VersionParser::parseLinks() in /home/jason/.composer/vendor/fxp/composer-asset-plugin/Repository/VcsPackageFilter.php on line 272

Fatal error: Call to undefined method Fxp\Composer\AssetPlugin\Package\Version\VersionParser::parseLinks() in /home/jason/.composer/vendor/fxp/composer-asset-plugin/Repository/VcsPackageFilter.php on line 272
[jason@kali:/var/www/learn]$ composer create-project yiisoft/yii2-app-advanced advanced 2.0.6
Installing yiisoft/yii2-app-advanced (2.0.6)


                                             
  [InvalidArgumentException]                 
  Project directory advanced/ is not empty.  
                                             


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]


[jason@kali:/var/www/learn]$ rm -rf advanced/*
[jason@kali:/var/www/learn]$ rm advanced/.bowerrc advanced/.gitignore 
[jason@kali:/var/www/learn]$ composer create-project yiisoft/yii2-app-advanced advanced 2.0.6
Installing yiisoft/yii2-app-advanced (2.0.6)
  - Installing yiisoft/yii2-app-advanced (2.0.6)
    Loading from cache

Created project in advanced
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing yiisoft/yii2-composer (2.0.3)               
    Loading from cache

  - Installing ezyang/htmlpurifier (v4.6.0)
    Loading from cache

  - Installing cebe/markdown (1.1.0)
    Loading from cache

  - Installing bower-asset/jquery (2.1.4)
    Loading from cache

  - Installing bower-asset/jquery.inputmask (3.1.63)
    Loading from cache

  - Installing bower-asset/punycode (v1.3.2)
    Loading from cache

  - Installing bower-asset/yii2-pjax (v2.0.5)
    Loading from cache

  - Installing yiisoft/yii2 (2.0.6)
    Loading from cache

  - Installing swiftmailer/swiftmailer (v5.4.1)
    Loading from cache

  - Installing yiisoft/yii2-swiftmailer (2.0.4)
    Loading from cache

  - Installing yiisoft/yii2-codeception (2.0.4)
    Loading from cache

  - Installing bower-asset/bootstrap (v3.3.5)
    Loading from cache

  - Installing yiisoft/yii2-bootstrap (2.0.5)
    Loading from cache

  - Installing yiisoft/yii2-debug (2.0.5)
    Loading from cache

  - Installing bower-asset/typeahead.js (v0.10.5)
    Loading from cache

  - Installing phpspec/php-diff (v1.0.2)
    Loading from cache

  - Installing yiisoft/yii2-gii (2.0.4)
    Loading from cache

  - Installing fzaninotto/faker (v1.5.0)
    Loading from cache

  - Installing yiisoft/yii2-faker (2.0.3)
    Loading from cache

fzaninotto/faker suggests installing ext-intl (*)
Writing lock file
Generating autoload files
[jason@kali:/var/www/learn]$ 
共收到 2 条回复 composer yii2
jason571#17年前 2 个赞

from :http://www.cnblogs.com/xinpureZhu/p/4989083.html

错误

很多时候即使是常用的命令也会出现一些奇奇怪怪的错误, 难以预知。。。

Input:

composer update

Output:

PHP Fatal error: Call to undefined method Fxp\Composer\AssetPlugin\Package\Version\VersionParser::parseLinks() in /root/.composer/vendor/fxp/composer-asset-plugin/Repository/VcsPackageFilter.php on line 272

Fatal error: Call to undefined method Fxp\Composer\AssetPlugin\Package\Version\VersionParser::parseLinks() in /root/.composer/vendor/fxp/composer-asset-plugin/Repository/VcsPackageFilter.php on line 272

解决方法

rm -rf ~/.composer/vendor/fxp

参考链接

https://github.com/yiisoft/yii2/issues/9794

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册