解决sudo rosdep init ERROR: cannot download default sources list from问题,亲测可用

解决sudo rosdep init ERROR: cannot download default sources list from问题,亲测可用

问题描述

按照 ros/installation在ubuntu 16.04上安装ros kinetic,在执行以下命令时
$ sudo rosdep init
$ rosdep update
出现以下错误:
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

在经历了长达一周的折磨后我终于解决了这个问题
首先
在本地新建对应目录/etc/ros/rosdep/sources.list.d
$ sudo mkdir -p /etc/ros/rosdep/sources.list.d
然后定位到该目录
$ cd /etc/ros/rosdep/sources.list.d
新建文件20-default.list:
sudo gedit 20-default.list
将下面这段话复制到文件中

# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosd`在这里插入代码片`ep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

在终端中执行rosdep update
这个时候你会发现还是没有办法下载
然后在终端中执行下面的命令

sudo gedit /etc/resolv.conf

将原有的nameserver这一行注释,并添加以下两行:

nameserver 8.8.8.8 #google域名服务器

nameserver 8.8.4.4 #google域名服务器

保存退出,执行

sudo  apt-get update

再执行

rosdep update

出现:

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Add distro "dashing"
Add distro "eloquent"
Add distro "foxy"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Add distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
updated cache in /home/gcx/.ros/rosdep/sources.cache

至此在继续执行

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

ros就安装好啦!
痛苦就可以解除了

你可能感兴趣的:(ros)