How to Solve Roscore Run error [Install ROS]

Command ‘roscore’ not found, but can be installed with:
sudo apt install python-roslaunch

Install Python Ross launch as prompted,

Error reporting: e: unable to correct problems, you have held broken packages

According to the online search, the binary executable named “roscore” may not exist in the folder “/opt/ROS/indigo/bin/”, and there will be no problem after having it

Solution:

1. First check whether there is a binary executable named roscore in the folder. If it does not exist, execute step 2. If it does exist, execute step 3

cd /opt/ros/melodic/bin
ls -l

2. If it does not exist, execute the following code, and then execute the first step to see if the roscore file exists. If it does, execute the third step

sudo apt-get install ros-melodic-desktop

3. If the roscore file is found in the first step, find the file named setup.sh under melody (the version of ROS you installed) and source its path

source /opt/ros/melodic/setup.sh

Enter roscore at the terminal, the problem is solved and the execution is successful.

Read More: