URL could not be accessed: HTTP/1.1 400 Bad URI

2020-03-19 06:00发布

问题:

I want to create a new laravel project via composer and I have got this error

 [Composer\Downloader\TransportException]
  The 'http://packagist.org/p/fideloper/proxy%249271e19129358853986ed3ca9315ced11a42439a57f49537033c3b436a6ff543.json
  ' URL could not be accessed: HTTP/1.1 400 Bad URI

回答1:

This question gets asked pretty frequently either here, github, or elsewhere. I'd almost say that this should be a community wiki entry. I've ran into this problem myself, as well, and here's a list of things to inspect and ensure they're not the cause (good chance one of them is the cause):

(Also, run composer diagnose -vvv ahead of time, then look at the list below)

  1. Proxy is incorrectly configured
  2. Firewall is incorrectly configured
  3. Bad global environment settings (bashrc, profile, etc)
  4. Outdated composer version
  5. Slow/degrading network performance
  6. Misconfigured git addons
  7. Incorrect settings in your hosts file
  8. SSH tunnelling misconfiguration

Note This is a poor answer, and isn't a good format for SO, really.