按composer update
命令更新yii2应用程序库时,composer-php已退出
[InvalidArgumentException]
Unknown downloader type: npm-signature. Available types: git, svn, fossil, hg, perforce, zip, rar, tar, gzip, xz, phar, file, path.
Exception trace:
() at phar:///usr/local/bin/composer/src/Composer/Downloader/DownloadManager.php:128
Composer\Downloader\DownloadManager->getDownloader() at phar:///usr/local/bin/composer/src/Composer/Downloader/DownloadManager.php:152
Composer\Downloader\DownloadManager->getDownloaderForInstalledPackage() at phar:///usr/local/bin/composer/src/Composer/Downloader/DownloadManager.php:211
Composer\Downloader\DownloadManager->download() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:186
Composer\Installer\LibraryInstaller->installCode() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:90
Composer\Installer\LibraryInstaller->install() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:173
Composer\Installer\InstallationManager->install() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:160
Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:588
Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:227
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:161
Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:242
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:842
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:251
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:100
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:58
require() at /usr/local/bin/composer:24
直到昨天,一切都在我当地的开发环境中按预期运作。
今天,在推送一些更新的同时,暂存和开发(与昨天更新相比没有任何变化)退出时出现上述错误。
这是我的composer.json
文件:
{
"name": "name/project",
"description": "Project",
"keywords": ["tags..."],
"homepage": "http://web.myaddress.yes/",
"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": "~2.0.0",
"yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0",
"dmstr/yii2-adminlte-asset": ">2",
"kartik-v/yii2-widgets": "^3.4",
"kartik-v/yii2-helpers": "^1.3",
"kartik-v/yii2-widget-activeform": "^1.4",
"kartik-v/yii2-datecontrol": "^1.9",
"kartik-v/yii2-editable": "^1.7",
"kartik-v/yii2-dropdown-x": "^1.2",
"kartik-v/yii2-dialog": "^1.0",
"kidzen/yii2-dynamicform": "^2",
"kartik-v/yii2-tabs-x": "^1.2",
"rmrevin/yii2-ionicon": "^1.2",
"kartik-v/yii2-date-range": "^1.6",
"kartik-v/php-date-formatter": "^1.3",
"kartik-v/yii2-export": "^1.2",
"webtoucher/yii2-js-cookie": "^1.0",
"lajax/yii2-translate-manager": "~1.7",
"mdmsoft/yii2-admin": "~2.0",
"elvenpath/yii2-eu-vatvalidator": "^1.1",
"kartik-v/yii2-widget-select2": "2.0",
"kartik-v/yii2-slider": "^1",
"edofre/yii2-fullcalendar-scheduler": "1.1.x-dev",
"kartik-v/yii2-mpdf": "dev-master"
},
"require-dev": {
"yiisoft/yii2-debug": "~2.0.0",
"yiisoft/yii2-gii": "~2.0.0",
"yiisoft/yii2-faker": "~2.0.0",
"codeception/base": "^2.2.3",
"codeception/verify": "~0.3.1"
},
"config": {
"process-timeout": 1800
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
]
}
这里有什么奇怪的东西,或者NPM服务器端有问题吗?
答案 0 :(得分:6)
另一种解决方法是使用bower-asset /而不是npm-asset。
我能够将所有npm资产套餐切换为bower-asset,并且运行良好。
注意:确保版本号匹配。
答案 1 :(得分:5)
此错误已在fxp/composer-asset-plugin
的{{3}}中得到修复,升级应解决此问题:
composer global require "fxp/composer-asset-plugin:^1.4.3"
Asset-packagist也是last release。
这是fxpio/composer-asset-plugin
fixed。似乎npm引入了bug,这打破了将npm包转换为composer包的插件。因此,使用此新功能的每个软件包都无法通过composer进行安装。
我不知道任何简单的解决方法,您需要等到错误得到修复。但是,如果您不能等待,可以尝试找到有问题的包并在composer.json
中手动定义。
"repositories": [
{
"type": "package",
"package": {
"name": "npm-asset/moment",
"version": "2.22.0",
"dist": {
"url": "https://registry.npmjs.org/moment/-/moment-2.22.0.tgz",
"type": "tar"
}
}
}
...
],
答案 2 :(得分:2)
最后问题已经解决了:
composer require
这里有得到的composer.json文件:
{
"name": "myapp name",
...,
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
...,
"bower-asset/moment": "V2.22.0",
"bower-asset/jquery": "V3.3.1",
"bower-asset/fullcalendar": "V3.8.0",
"edofre/yii2-fullcalendar-scheduler": "V1.1.12"
},
"require-dev": {
"yiisoft/yii2-debug": "~2.0.0",
"yiisoft/yii2-gii": "~2.0.0",
"yiisoft/yii2-faker": "~2.0.0",
"codeception/base": "^2.2.3",
"codeception/verify": "~0.3.1"
},
"config": {
"process-timeout": 1800
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
]
}
我认为目标是在插件本身之前安装插件所需的资产
注意:我的Yii2安装时没有composer-asset-plugin