I'm using Ubuntu 12.04 and ROS Hydro.

While creating a package in one of my directories, i wrote the following line of code to the terminal (because i was facing the problem mentioned in here):

export ROS_PACKAGE_PATH=~/<PATH TO THE DIRECTORY I WAS MAKING THE PACKAGE IN>


After adding this line, i'm facing this error:

[rospack] Error: stack/package roscpp not found


whenever i type the following code:

rospack find roscpp


Although the package roscpp is still present at this path: /opt/ros/hydro/share$ What is causing this issue? How do i solve it? edit retag close merge delete ## 1 Answer Sort by » oldest newest most voted What is causing this issue? With: export ROS_PACKAGE_PATH=~/<PATH TO THE DIRECTORY I WAS MAKING THE PACKAGE IN>  you are overwriting the ROS_PACKAGE_PATH variable, so that it only points to ~/<PATH TO THE DIRECTORY I WAS MAKING THE PACKAGE IN>. The default paths needed for ROS to function are now gone, hence the error message you received. If you really must change/update ROS_PACKAGE_PATH manually, be sure to only add to it. Something like: export ROS_PACKAGE_PATH=/home/user/path/to/dir/i/was/making/pkg/in:$ROS_PACKAGE_PATH


This inserts the new path and copies in the old entries.

How do i solve it?

Depending on how you setup your system, simply opening a new terminal could restore the old ROS_PACKAGE_PATH values. Alternatively, source /opt/ros/hydro/setup.bash should also set the variable to its default value.

more