Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer fail on update with "npm-signature" error

While updating my yii2 application libraries by composer update command, composer-php exited with

[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

Until yesterday everything worked as expected on my local develop environment.

Today, while pushing some updates, both staging and develop (who has no changes compared to the yesterday update) exit with the above error.

This is my composer.json file:

{
"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"
    }
]
}

Is there something strange here or maybe a problem NPM server side?

like image 324
Gianpaolo Scrigna Avatar asked Apr 20 '18 11:04

Gianpaolo Scrigna


2 Answers

UPDATE

This bug was fixed in the last release of fxp/composer-asset-plugin, upgrade should fix the issue:

composer global require "fxp/composer-asset-plugin:^1.4.3"

Asset-packagist was also fixed.


This is fxpio/composer-asset-plugin bug. Seems like npm introduced a new feature into dist info, and this breaks plugin which converts npm packages to composer packages. So every package which use this new feature, will not be able to install via composer.

I don't known any easy workaround, you need to wait until bug gets fixed. But if you can not wait, you can try locate problematic package and define it manually in your 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"
            }
        }
    }
    ...
],
like image 157
rob006 Avatar answered Dec 03 '22 19:12

rob006


Another workaround is to use the bower-asset/ instead of npm-asset.

I was able to switch all of my npm-asset packages to bower-asset and it worked perfectly.

Caution: be sure the version numbers match up.

like image 41
Art Williams Avatar answered Dec 03 '22 17:12

Art Williams