[Composer\Downloader\TransportException] The "http://packagist.org/packages.json" file could not be downloaded: failed to open stream: HTTP request failed!create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--n o-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [package] [directory] [version]
解決方法禁用https請求,改用http方式。所以我們在composer.json檔案中設定一個本地或全域性的composer設定config
方法一:命令列composer config secure-http false。通過命令修改composer.json,效果等同方法二。
方法二:直接改composer.json,給「config」項中加上"secure-http": false
"config" : { "vendor-dir" : "packages", "secure-http": false }
全域性設定(推薦)
composer config -l -g//切換到國內源 阿里composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/composer config -g --unset repos.packagist
以上就是解決composer錯誤:Composer\Downloader\TransportException的詳細內容,更多請關注TW511.COM其它相關文章!