I've created a Debian .deb package that populates my project onto a user's machine. I run "npm install" commands for my dependencies in the postinst script, but this requires the user to have an internet connection, which will not always be the case. I was wondering if there is a best practice where I can include the npm modues as dependencies that are included within the .deb file?
Yes, it is possible. Node-RED is a node.js application and they are relatively straight-forwards to package into a redistributable archive.
The only tricky part would be if you had to handle more than one platform since some nodes require compiling. Not a problem if you are always on the same platform since the compiled code will work just fine.
Thanks for the response, TI. When building my .deb package, there is a "control" file that contains a "Depends" and "Recommends" section, and if I add the names of debian software packages here they will be added to my .deb file. Is adding npm modules a similar process? Do you know of any good tutorials describing this process? I've searched endlessly and have come up short.
There is no real link between a deb package and an npm package. You need to look at how Node.JS devs package up code for offline installation. Not an area that I am expert in.
The brute force method would be to install everything somewhere that has the same platform type and then take an archive of it, in your deb you should be able to unpack the archive on installation I think?
Indeed that is the way we do it for the Pi build... do a clean install, remove a load of crud (like test and benchmark code), add the control files and, then pack it all back up as a deb. Ugly but it works.
Perhaps look at https://www.npmjs.com/package/node-deb
We've used it successfully in the past. The idea is to npm install before building and including the node_modules folder in your build.