Reputation: 55
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!
Upvotes: 2
Views: 33632
Reputation: 1
I might be that you are not running bash shell.If you are using another shell must be make change in setup file like this
source /opt/ros/kinetic/setup.bash
to
source /opt/ros/kinetic/setup.sh
Upvotes: 0
Reputation: 61
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
(i.e., 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
Upvotes: 6
Reputation: 411
The packages or files were not actually downloaded from the "http://wiki.ros.org/melodic/Installation/Ubuntu". To overcome this error first open terminal
check your directory pwd
. If your directory is like /home/'Your PC Name' it won't actually work.
Change the directory : Type cd /
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
Upvotes: 1
Reputation: 2697
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
Upvotes: 2