How to fix ROS colcon build error: Could not find a package configuration file provided by "hardware_interface"
Problem
While building a ROS2 workspace using colcon build, you see the following error log:
example.txt
CMake Error at CMakeLists.txt:11 (find_package):
By not providing "Findhardware_interface.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"hardware_interface", but CMake did not find one.
Could not find a package configuration file provided by
"hardware_interface" with any of the following names:
hardware_interfaceConfig.cmake
hardware_interface-config.cmake
Add the installation prefix of "hardware_interface" to CMAKE_PREFIX_PATH or
set "hardware_interface_DIR" to a directory containing one of the above
files. If "hardware_interface" provides a separate development package or
SDK, be sure it has been installed.Solution
In order to install it, use:
example.sh
sudo apt -y install ros-jazzy-hardware-interfaceor similar, for your distribution.
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow