You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Interface broken with custom msg: "Error The message required does not exist: {ros2_package}, msg, {ros2_msg} at /{server_dir}/node_modules/rclnodejs/generated/" #1254
Description
I firstly created a ROS2 pkg with custom msg, used colcon build in this pkg and successfully tested.
Then I would like to get msg from topic defined in this pkg.
When starting the server, I got the error:
UNCAUGHT EXCEPTION! System Shutting down...
Error The message required does not exist: {ros2_package}, msg, {ros2_msg} at /{server_dir}/node_modules/rclnodejs/generated/
The error still exist even I have sourced the pkg with:
const app = require("./app");
const ros2Node = require("./utils/ros2Node");
// start ROS2 node
const node = ros2Node.initROS2();
// start server
const port = 3000;
app.listen(port, () => {
console.log(`App running on port ${port}...`);
});
I have tried to make my server project as a ros2 pkg, ros2 pkg create web_interface --build-type ament_nodejs --dependencies rclnodejs
but got error: ros2 pkg create: error: argument --build-type: invalid choice: 'ament_nodejs' (choose from 'cmake', 'ament_cmake', 'ament_python')
using npx npx generate-ros-messages
got error: sh: 1: generate-ros-messages: Exec format error
using npm npm run generate-messages-idl
got error:
npm error Missing script: "generate-messages-idl"
npm error
npm error To see a list of scripts, run:
npm error npm run
npm error A complete log of this run can be found in: /home/vicky/.npm/_logs/2025-09-07T06_21_38_347Z-debug-0.log
Library Version: 1.5.0
ROS Version: humble
Platform / OS: Ubuntu 22.04 LTS
Node version: 20.19.4
Steps To Reproduce
run node server.js in terminal.
hi @VickyXR thanks for yoru feedback! When you introducing new package of msg/srv/action, you need to run
See details, i think we can do some improvement definitely here, like scan if any new package installed, and if yes, we can generate the JavaScript messages in runtime.
@minggangw Problem solved! The error was caused by the file generate-ros-messages. I have used gedit to check it and found:
IntxLNK../rclnodejs/scripts/generate_messages.js
Maybe it was some unclear error caused during my first installation, just like the error in my last issue > <. Then I removed and installed it again, the content of this file was well fixed!
Activity
minggangw commentedon Sep 8, 2025
hi @VickyXR thanks for yoru feedback! When you introducing new package of msg/srv/action, you need to run
See details, i think we can do some improvement definitely here, like scan if any new package installed, and if yes, we can generate the JavaScript messages in runtime.
VickyXR commentedon Sep 8, 2025
@minggangw Problem solved! The error was caused by the file
generate-ros-messages. I have used gedit to check it and found:Maybe it was some unclear error caused during my first installation, just like the error in my last issue > <. Then I removed and installed it again, the content of this file was well fixed!
Thanks for your attention!
minggangw commentedon Sep 10, 2025
After #1257 lands , running
npx generate-ros-messagesis not needed anymore if new message added.Write generated/generator.json only after message generation completes (