This step informs system environment variables (such as PATH and PYTHONPATH) where your custom nodes and message definitions live, allowing ros2 run command execution from any terminal path!
After creating a new ROS 2 package in ros2_ws/src/ and building it with colcon build, your terminal says ros2 run my_pkg my_node cannot be found. What step was likely skipped?
Incorrect. Restarting the operating system has no effect on whether the workspace environment variables are loaded into your shell.
You forgot to source the workspace setup script (source install/setup.bash).
Correct! Without sourcing install/setup.bash, your shellβs PATH and PYTHONPATH never learn where your newly built packageβs executables live, so ros2 run cannot find them.
You forgot to delete the log/ folder.
Incorrect. The log/ folder only stores build and execution logs; it has no effect on whether commands are found.
You didnβt run colcon build inside the src/ folder.
Incorrect. colcon build is meant to be run at the workspace root, not inside src/; running it from the wrong directory would produce a build error, not a missing-command error after a successful build.