I would recommend using nvm nvm
(Node Version Manager), it provides an easy way to install multiple versions of node on a single computer.
Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
Open a new terminal to get access to nvm
Install node
nvm install 17
sudo snap install node --classic --channel=17
node -v
This should print out v17.*.*
if node is installed correctly
We use, pnpm
instead of npm
. Read why here
In general, pnpm
is a drop-in replacement for npm
but it is faster, uses less storage, and is generally better.
Any npm
command should work the exact same if you just replace it with pnpm
.
Install it with:
npm install -g pnpm
Note: All of the following commands including this one need to be run in the blueshift_web
directory
pnpm install
Note: Until RobotWebTools/roslibjs#548 is fixed, running the website in development mode won't work. The ROS based build/launch scripts are still functional, but when developing the website, it needs to be manually built using This should be fixed (see this commit). Its a kind of janky hack, but works.pnpm run build
and then pnpm run preview
pnpm run dev
If it needs to be accessible on other computers on your network
pnpm run dev -- --host
If the website needs to communicate with ROS (i.e. you are doing anything more than UI development), you need to start the rosbridge node:
ros2 launch rosbridge_server rosbridge_websocket_launch.xml
To build it:
colcon build --packages-select blueshift_web
Note 1: This first time it is built, this might take a long time, because all the node packages need to be copied over to the install folder. Every subsequent time, it should only copy over the difference, so it should be faster. TODO later: there may be a way to just re-download them into the install directory which might be quicker.
Note 2: Building this with the These should be fixed as of these commits--symlink-install
flag seems to raise cause an issue with symlinks, so this package (and probably the whole workspace) should be built without that flag.
To run it (this also starts the rosbridge_server to facilitate JS<->ROS communication)
ros2 launch blueshift_web simple.launch.py
Note: if there are any errors about missing packages, make download all dependencies as described here
Joystick functionality will only work correctly in a Chrome based browser (ie. Chrome or Chromium).