完美解決呼叫“sudo rosdep init“命令時的報錯

凌波一夢發表於2020-08-24

在安裝完畢Ubuntu系統後,我們執行命令sudo rosdep init時往往會遇到如下報錯:

$ sudo rosdep init
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.

這是因為raw.githubusercontent.com被牆,程式無法下載相應的檔案導致的。

完美解決方法如下:

1. 開啟檔案/etc/hosts:

$ sudo vim /etc/hosts

2. 在檔案末尾新增一行如下內容:

151.101.84.133 raw.githubusercontent.com

3. 儲存退出,重新執行命令

$ sudo rosdep init

4. 最後執行命令

$ 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"
Add distro "rolling"
updated cache in /home/mlb/.ros/rosdep/sources.cache

完美解決!

相關文章