{"id":1560,"date":"2021-12-05T01:03:46","date_gmt":"2021-12-04T17:03:46","guid":{"rendered":"https:\/\/www.siediyer.cn\/?p=1560"},"modified":"2021-12-05T01:03:46","modified_gmt":"2021-12-04T17:03:46","slug":"php-composer-%e5%ae%89%e8%a3%85%e6%8a%a5%e9%94%99-package-fxp-composer-asset-plugin-has-a-php-requirement-incompatible-with-your-php","status":"publish","type":"post","link":"https:\/\/www.siediyer.cn\/?p=1560","title":{"rendered":"php composer \u5b89\u88c5\u62a5\u9519 Package fxp\/composer-asset-plugin has a PHP requirement incompatible with your PHP"},"content":{"rendered":"<h2>\u4e8b\u60c5\u7ecf\u8fc7<\/h2>\n<p>\u4e0b\u8f7dphp\u7684composer\u6700\u65b0\u7248,\u5b89\u88c5yii2\u6846\u67b6,\u62a5\u9519<\/p>\n<h2>\u62a5\u9519\u5185\u5bb9<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">[InvalidArgumentException]                                                                                                        \r\nPackage fxp\/composer-asset-plugin has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version:  \r\n- fxp\/composer-asset-plugin requires composer-plugin-api ^1.0 which does not match your installed version 2.1.0.     \r\n\r\nException trace:\r\n () at phar:\/\/\/usr\/local\/bin\/composer\/src\/Composer\/Command\/InitCommand.php:845\r\n Composer\\Command\\InitCommand-&gt;findBestVersionAndNameForPackage() at phar:\/\/\/usr\/local\/bin\/composer\/src\/Composer\/Command\/InitCommand.php:498\r\n Composer\\Command\\InitCommand-&gt;determineRequirements() at phar:\/\/\/usr\/local\/bin\/composer\/src\/Composer\/Command\/RequireCommand.php:189\r\n Composer\\Command\\RequireCommand-&gt;execute() at phar:\/\/\/usr\/local\/bin\/composer\/vendor\/symfony\/console\/Command\/Command.php:245\r\n Symfony\\Component\\Console\\Command\\Command-&gt;run() at phar:\/\/\/usr\/local\/bin\/composer\/vendor\/symfony\/console\/Application.php:835\r\n Symfony\\Component\\Console\\Application-&gt;doRunCommand() at phar:\/\/\/usr\/local\/bin\/composer\/vendor\/symfony\/console\/Application.php:185\r\n Symfony\\Component\\Console\\Application-&gt;doRun() at phar:\/\/\/usr\/local\/bin\/composer\/src\/Composer\/Console\/Application.php:312\r\n Composer\\Console\\Application-&gt;doRun() at phar:\/\/\/usr\/local\/bin\/composer\/vendor\/symfony\/console\/Application.php:117\r\n Symfony\\Component\\Console\\Application-&gt;run() at phar:\/\/\/usr\/local\/bin\/composer\/src\/Composer\/Console\/Application.php:125\r\n Composer\\Console\\Application-&gt;run() at phar:\/\/\/usr\/local\/bin\/composer\/src\/Composer\/Command\/GlobalCommand.php:111\r\n Composer\\Command\\GlobalCommand-&gt;run() at phar:\/\/\/usr\/local\/bin\/composer\/vendor\/symfony\/console\/Application.php:835\r\n Symfony\\Component\\Console\\Application-&gt;doRunCommand() at phar:\/\/\/usr\/local\/bin\/composer\/vendor\/symfony\/console\/Application.php:185\r\n Symfony\\Component\\Console\\Application-&gt;doRun() at phar:\/\/\/usr\/local\/bin\/composer\/src\/Composer\/Console\/Application.php:312\r\n Composer\\Console\\Application-&gt;doRun() at phar:\/\/\/usr\/local\/bin\/composer\/vendor\/symfony\/console\/Application.php:117\r\n Symfony\\Component\\Console\\Application-&gt;run() at phar:\/\/\/usr\/local\/bin\/composer\/src\/Composer\/Console\/Application.php:125\r\n Composer\\Console\\Application-&gt;run() at phar:\/\/\/usr\/local\/bin\/composer\/bin\/composer:64\r\n require() at \/usr\/local\/bin\/composer:24\r\n\r\n<\/pre>\n<h2>\u539f\u56e0<\/h2>\n<p>\u4e0b\u8f7d\u7684composer\u7248\u672c\u592a\u9ad8\uff0c2.1.x\u7248\u672c\uff0c\u4f46\u8fd9\u4e2a\u63d2\u4ef6\u4e0d\u652f\u63012.x\u7684\uff0c\u5fc5\u987b\u75281.x\u7684\u3002<br \/>\n\u91cd\u65b0\u53bbcomposer\u5b98\u7f51\u4e0b\u8f7d 1.x\u7684composer \uff0c\u91cd\u65b0\u6267\u884c<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wget https:\/\/getcomposer.org\/download\/1.10.22\/composer.phar\r\nphp composer.phar global require \"fxp\/composer-asset-plugin:~1.4\" -vvv\r\ncomposer.phar install -vvv\r\n<\/pre>\n<h2>\u4e0b\u8f7d\u62a5\u9519<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">[Composer\\Downloader\\TransportException]                                    \r\nContent-Length mismatch, received 136823 bytes out of the expected 1751254  \r\n<\/pre>\n<p>\u7ee7\u7eed\u89e3\u51b3\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># \u8c03\u5927\u7f13\u5b58\r\nphp composer.phar config --global cache-files-maxsize 1024\r\n\r\n# \u4f7f\u7528\u534e\u4e3a\u955c\u50cf\r\ncomposer config -g repo.packagist composer https:\/\/mirrors.aliyun.com\/composer\/\r\n<\/pre>\n<h2>\u95ee\u9898\u89e3\u51b3<\/h2>\n<p>\u5176\u5b9e\u95ee\u9898\u6839\u6e90\u5728\u4e8e\u8fd9\u4e2a\u63d2\u4ef6\u00a0<code>fxp\/composer-asset-plugin<\/code>\u00a0\u4e0d\u652f\u63012.x\u7248\u672c\u7684composer\u5bfc\u81f4\uff0c\u76ee\u524d\u5bf9\u65b9\u8fd8\u6ca1\u8fdb\u884c\u4efb\u4f55\u66f4\u65b0\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Package phpunit\/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.\r\nPackage codeception\/base is abandoned, you should avoid using it. No replacement was suggested.\r\nPackage facebook\/webdriver is abandoned, you should avoid using it. Use php-webdriver\/webdriver instead.\r\nReading \/projects\/gogoman\/vendor\/composer\/installed.json\r\nWriting lock file\r\nGenerating autoload files\r\n33 packages you are using are looking for funding.\r\nUse the `composer fund` command to find out more!\r\n<\/pre>\n<p><strong>\u66f4\u65b0\u4e8e2021\/07\/14<\/strong><br \/>\n\u6700\u6b63\u786e\u7684\u89e3\u51b3\u529e\u6cd5\u662f\u5c31\u662f\u91cd\u65b0\u5b89\u88c5\uff0c\u5220\u9664composer.json\uff0c\u91cd\u65b0\u5b89\u88c5\u3002<br \/>\ncomposer2.x\u4e0d\u9700\u8981\u5f15\u5165 fxp\u4f9d\u8d56\uff0c\u76f4\u63a5\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\uff0cfxp\u4f5c\u8005\u4f30\u8ba1\u662f\u770b\u5230composer2.x\u4e0d\u518d\u4f9d\u8d56\uff0c\u6240\u4ee5\u4e0d\u518d\u66f4\u65b0\u7ef4\u62a4\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e8b\u60c5\u7ecf\u8fc7 \u4e0b\u8f7dphp\u7684composer\u6700\u65b0\u7248,\u5b89\u88c5yii2\u6846\u67b6,\u62a5\u9519 \u62a5\u9519\u5185\u5bb9 [InvalidArgumen [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1560","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/1560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1560"}],"version-history":[{"count":1,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/1560\/revisions"}],"predecessor-version":[{"id":1561,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/1560\/revisions\/1561"}],"wp:attachment":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}