简体   繁体   中英

ROS installation: no such file or directory

According to ros wiki, to set up environment, I typed

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

The error is

/opt/ros/kinetic/setup.bash:.:8: no such file or directory: /home/pikashun/setup.sh

In ~/.bashrc file, there is the source /opt/ros/kinetic/setup.bash line.

I use Ubuntu on WSL. How can I improve?

Thank you!

I had the exact same issue. The problem is not due to setup.bash either ~/.bashrc but the shell that you are using. It turned out that you may be using a different shell than bash (ie, zsh ). When you are executing the setup.bash of ROS, zsh interprets the following command (whici is in /opt/ros/kinetic/setup.bash ) differently:

_CATKIN_SETUP_DIR=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd)

It is setting the _CATKIN_SETUP_DIR to your user directory. That is why you are getting error, cause you using the wrong path: /home/user/setup.bash instead of /opt/ros/kinetic/setup.bash

To check whether this is the issue of your problem, you can check the shell that you are using by execute the following in the terminal:

echo $0; echo $SHELL

It may return something like:

zsh
/bin/zsh

To switch from zsh to bash , use:

exec bash

Once done this, you can use source without any problem.

And to switch back to your previous shell (assuming that is zsh ), just use:

exec zsh

The file /opt/ros/kinetic/setup.bash does nothing but loading /opt/ros/kinetic/setup.sh from the same directory. I might be that you are not running bash ( check which terminal you run ), or that WSL has some different behavoiour than expected. However, your can just alter your append command like so:

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

or in your case, since the entry exists already in your ~/.bashrc , edit the line source /opt/ros/kinetic/setup.bash to source /opt/ros/kinetic/setup.sh

The packages or files were not actually downloaded from the " http://wiki.ros.org/melodic/Installation/Ubuntu ". To overcome this error first open terminal

  1. check your directory pwd . If your directory is like /home/'Your PC Name' it won't actually work.

  2. Change the directory : Type cd /

  3. Continue the installation process from start which mentioned in " http://wiki.ros.org/melodic/Installation/Ubuntu "

melodic can change to kinetic or other version if you wish

have you installed kinetic ? you could check the path by

/opt/ros/kinetic

do you see setup.bash

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM