Cannot locate node of type [rosnode] in package [rosnode] [closed]
In ros-noetic, ubuntu 20.04, I am launching the following roslaunch file:
<?xml version="1.0"?>
<launch>
<node pkg="rosnode" type="rosnode" name="kill_all_nodes" args="kill -a" />
</launch>
However, I get this error:
ERROR: cannot launch node of type [rosnode/rosnode]: Cannot locate node of type [rosnode] in package [rosnode]. Make sure file exists in package path and permission is set to executable (chmod +x)
I did chmod +x
to /opt/ros/noetic/bin/rosnode
, but it didn't change anything. It had the execution rights anyway.
In a comment under a related question, someone else reported having the same problem, but I could not find any solution. Following that comment, rosls rosnode
produces only these:
cmake package.xml
I can run rosnode kill -a
from the terminal successfully.
What could be the cause of the error above?
Please refer to #q292912.
Thank you for editing the answer there. I will put the solution also here as it is not exactly the same question.
I'm not sure why the two questions are not the same.
Could you clarify?
Let's not duplicate content unnecessarily.
Oh, just noticed that you closed it for being a duplicate, but it is not. The other question asks whether they can kill a node from a launch file. The original answer (before the last edit) was actually a good answer. Except that the rosnode package has this issue. This question asks why such an error (as in the title) happens, and apparently the reason is an issue about how rosnode installs...
While technically correct, I feel in this case it doesn't really matter.
Without ros/ros_comm#2262, no matter whether you use the correct syntax, you'll run into the problem you describe. The last comment on my answer to #q292912 reports the exact same problem.
If the last comment on #q292912 was merged into the original question text, we would get your question here ...
Thank you for creating the issue in ros_comm. Anyway, when that issue is solved this question will become obsolete, so let's keep this one closed.
Unlike killing a single node, apparently, kill all causes another issue. Please refer to this issue.