fxpio / composer-asset-plugin

NPM/Bower Dependency Manager for Composer
MIT License
892 stars 156 forks source link

npm-assets not working : Composer\Downloader\TransportException Your configuration does not allow connection to http://registry.npmjs.org. See https://getcomposer.org/doc/06-config.md#secure-http for details. #198

Closed sasedev closed 8 years ago

sasedev commented 8 years ago

composer.json example: ... "require" : { ... "npm-asset/angular-chosen" : "~1.0", ...

composer.phar update -vvv ... Analyzed 7348 packages to resolve dependencies Analyzed 249809 rules to resolve dependencies

Exception trace: () at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Util/RemoteFilesystem.php:271 Composer\Util\RemoteFilesystem->get() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Util/RemoteFilesystem.php:84 Composer\Util\RemoteFilesystem->copy() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Downloader/FileDownloader.php:139 Composer\Downloader\FileDownloader->doDownload() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Downloader/FileDownloader.php:91 Composer\Downloader\FileDownloader->download() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Downloader/ArchiveDownloader.php:36 Composer\Downloader\ArchiveDownloader->download() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Downloader/DownloadManager.php:213 Composer\Downloader\DownloadManager->download() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Installer/LibraryInstaller.php:177 Composer\Installer\LibraryInstaller->installCode() at /home/sasedev/Dev/www/ilcfrance-orange/vendor/fxp/composer-asset-plugin/Installer/AssetInstaller.php:87 Fxp\Composer\AssetPlugin\Installer\AssetInstaller->installCode() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Installer/LibraryInstaller.php:91 Composer\Installer\LibraryInstaller->install() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Installer/InstallationManager.php:152 Composer\Installer\InstallationManager->install() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Installer/InstallationManager.php:139 Composer\Installer\InstallationManager->execute() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Installer.php:592 Composer\Installer->doInstall() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Installer.php:219 Composer\Installer->run() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Command/UpdateCommand.php:173 Composer\Command\UpdateCommand->execute() at phar:///home/sasedev/Dev/www/composer.phar/vendor/symfony/console/Command/Command.php:259 Symfony\Component\Console\Command\Command->run() at phar:///home/sasedev/Dev/www/composer.phar/vendor/symfony/console/Application.php:844 Symfony\Component\Console\Application->doRunCommand() at phar:///home/sasedev/Dev/www/composer.phar/vendor/symfony/console/Application.php:192 Symfony\Component\Console\Application->doRun() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Console/Application.php:166 Composer\Console\Application->doRun() at phar:///home/sasedev/Dev/www/composer.phar/vendor/symfony/console/Application.php:123 Symfony\Component\Console\Application->run() at phar:///home/sasedev/Dev/www/composer.phar/src/Composer/Console/Application.php:99 Composer\Console\Application->run() at phar:///home/sasedev/Dev/www/composer.phar/bin/composer:43 require() at /home/sasedev/Dev/www/composer.phar:25

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] []...

cebe commented 8 years ago

npm registry is available via https so it should be possible to fix this. https://registry.npmjs.org/

cebe commented 8 years ago

@sasedev as a workaround you may use this composer setting: https://getcomposer.org/doc/06-config.md#secure-http

sasedev commented 8 years ago

but why is it connecting to http://registry.npmjs.org instead of https://registry.npmjs.org ? this problem start appearing with this issue https://github.com/francoispluchino/composer-asset-plugin/issues/191 as you suggested it worked with:

...

"config" : {
    "bin-dir" : "bin",
    "component-dir" : "vendor",
    "platform" : {
        "php" : "5.5.9"
    },
    "secure-http" : false
},

...

but why do i have to set secure-http to false ?

cebe commented 8 years ago

good question, the url in the code contains HTTPS: https://github.com/francoispluchino/composer-asset-plugin/blob/f84731b714c4c8dc090c629b631c1fc7bd235d95/Repository/NpmRepository.php#L40

mougrim commented 8 years ago

I think this problem becouse urls with http on registry.npmjs.org, for example https://registry.npmjs.org/node-uuid/ contains http url: "tarball":"http://registry.npmjs.org/node-uuid/-/node-uuid-1.2.0.tgz" May be change http to https?

mougrim commented 8 years ago

My fix for this issue https://github.com/francoispluchino/composer-asset-plugin/pull/199

francoispluchino commented 8 years ago

Fixed by #199.