Nodejs and Module Management on Linux¶
Overview¶
This is a setup for a tiny HMI project built in js running on Raspberry Pi.
- HMI goals is display a data stream from a sensor.
- The Nodejs engine and PM2 help to speed the data transmission and display on the UI.
Node Installation & Dependencies¶
Check if the version is the last LTS one
Check the node.js & npm version
Install build-essential package¶
Install Process Manager (PM2)¶
Warning: - Each time you reboot your machine you have to start the server!** - Make the server load when the Pi reboots
HMI¶
The HMI has two modules
- Server Module
server.js: handle the PM2 engine - Client Mudule
clien.js: handle Hmi frontend configuration
To start the server
Save the state of the server to be launched after the next reboot of the system :
Reboot the system to take the effect
PM2 Usages¶
- Start the server (with watch)
- Restart the server (without watch)
- Monitor the server
- List of server launch with PM2
Install Nodejs packages modules both for the client and the server¶
Go into the client folder and run
Run the npm package for the client
Go into the server folder and run
Local Dev¶
Deployement => Production¶
- How to build the client files after a modification or an update
- build the new modification and this will generate new setup files for the HMI