Composer require 包时报错, 如何解决?

我用的是国内源, 报如下错误:

The "https://packagist.laravel-china.org/packag..." file could not be downloaded: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
https://packagist.laravel-china.org could not be fully loaded, package information was loaded from the local cache and may be out of date

切换回了官方源,还是报同样的错误:

The "https://packagist.org/packages.json" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date

Allen
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 5
leo

目测是 DNS 没配好,nslookup baidu.com 看看

5年前 评论

好了,好像是 homestead 的 DNS客户端宕机了。

5年前 评论

@theDog 你好, 你是怎么搞好的啊, 我也遇上这个问题了, 我是在阿里云服务器上

5年前 评论

@xzf_laravel 你可以试着重启服务器或者重启网络服务

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!