작성기에서 [ReflectionException] 클래스 Fxp \ Composer \ AssetPlugin \ Repository \ NpmRepository가 존재하지 않습니다.
최신 버전 (1.0.0. stable)의 작곡가를 설치했고 Yii2 프로젝트에서 다음을 입력했습니다.
php composer.phar update
이 오류가 발생합니다.
[ReflectionException] 클래스 Fxp \ Composer \ AssetPlugin \ Repository \ NpmRepository가 없습니다.
[ErrorException] Fxp \ Composer \ AssetPlugin \ Repository \ AbstractAssetsRepository :: whatProvides () 선언은 Composer \ Repository \ ComposerRepository :: whatProvides (Composer \ DependencyResolver \ Pool $ pool, $ name, $ bypassFilters = false)와 호환되어야합니다.
누군가이 문제를 해결하는 방법을 도울 수 있습니까?
여기 내 composer.json이 있습니다.
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Project Template",
"keywords": ["yii2", "framework", "advanced", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.6",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"kartik-v/yii2-widget-fileinput": "@dev",
"golonka/bbcodeparser": "^2.2"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"process-timeout": 1800
},
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
}
약 9 일 전 (2016 년 3 월 말경) Composer\Repository\ComposerRepository::whatProvides
API가 변경되었습니다. ( # 2668 ) 따라서 fxp/composer-asset-plugin
전역 적으로 설치했다면 업데이트해야합니다. 다음과 같이 할 수 있습니다.
php composer.phar global update fxp/composer-asset-plugin --no-plugins
업데이트가 작동하지 않으면 이것을 시도하십시오.
composer global require fxp/composer-asset-plugin --no-plugins
나는 fxp
디렉토리에서 디렉토리를 제거하여 문제를 해결했습니다 .composer
. 내 설정에서 이것은 트릭을 수행합니다.
rm -rf ~/.composer/vendor/fxp
이제 필요한 것이 있으면 업데이트 된 플러그인을 다시 다운로드 할 수 있습니다.
다음 composer.json
을 실행 하여 글로벌을 편집하십시오 .
vi ~/.composer/composer.json
그런 다음 다음 줄이 있는지 확인하십시오.
{
"require": {
"fxp/composer-asset-plugin": "1.1.*"
}
}
위의 답변은 내 버전이로 변경 되고 업데이트 명령을 실행 했을 때 fxp/composer-asset-plugin
와 같았 기 때문에 저에게 효과적이지 않았습니다 .1.1-beta04
"1.1.8"
php /usr/bin/composer global update fxp/composer-asset-plugin --no-plugins
문제가 해결되었습니다. 하지만 내 global을 편집하지 않고 composer.json
다음과 같은 오류가 발생했습니다.
설치 가능한 패키지 세트로 요구 사항을 해결할 수 없습니다.
Problem 1 - Installation request for fxp/composer-asset-plugin 1.0.0-beta3 -> satisfiable by fxp/composer-asset-plugin[v1.0.0-beta3]. - fxp/composer-asset-plugin v1.0.0-beta3 requires composer-plugin-api 1.0.0 -> no matching package found.
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://getcomposer.org/doc/04-schema.md#minimum-stability for more details.
Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
In my case project on Yii2
$ composer
[ReflectionException]
Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist
[ErrorException]
Declaration of Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository
::whatProvides() should be compatible with Composer\Repository\ComposerRepo
sitory::whatProvides(Composer\DependencyResolver\Pool $pool, $name, $bypass
Filters = false)
Yii2, in folder vendor/fxp
you need to replace the folder composer-asset-plugin
or delete it.
If none of the other solutions have worked for you, please try AssetPackagist as an alternative.
Add the packages bower-asset/bootstrap and npm-asset/jquery to composer.json like the following:
"require": { "bower-asset/bootstrap": "^3.3", "npm-asset/jquery": "^2.2" }
Add a repositories block (if you still don't have one, if you do, just append to it) with the following content:
"repositories": [ { "type": "composer", "url": "https://asset-packagist.org" } ]
Run
composer install
(orcomposer update
)Considering that asset-packagist installs assets in a different directory, add the following lines to your application config (usually called as web.php):
$config = [ 'aliases' => [ '@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset', ], ];
These instructions may change over time. They have been copied from the repo website so they could last in time just in case something happens to the website. I am not the author of the repo but I really appreciate the effort made into it. Please check https://asset-packagist.org/site/about to know more about the project.
If you are struggling with composer, here you have some useful commands:
composer clear-cache
- Clear composer related caches
composer install -vvv
- Add the parameter "vvv" to show installation process related output (useful to debug)
composer global show
- Useful to check if you already have fxp/composer-asset-plugin installed. In my case, it already was, however it was not being detected as a dependency, and the solution I described earlier worked flawless to me - hope it does work for you too!
You can make a permanent fix by requiring it at global level and then it's solved for every other project. But then make sure you give the tip to all your team members.
Best is to add this at project scope and it solves to everybody that way.
So:
composer require fxp/composer-asset-plugin
'Program Tip' 카테고리의 다른 글
활동에서 getSupportFragmentManager ()를 호출 할 수 없습니다. (0) | 2020.10.08 |
---|---|
이온 프레임 워크 버전을 얻는 방법은 무엇입니까? (0) | 2020.10.08 |
OSX Safari의 개발 메뉴에 iPad가 표시되지 않음 (0) | 2020.10.08 |
NSString을 NSDictionary / JSON으로 변환 (0) | 2020.10.08 |
Python : ISO-8859-1 / latin1에서 UTF-8로 변환 (0) | 2020.10.08 |