I successfully created a project on nodered using an offline installer by TotallyInformation. It means I can run nodered projects independently.
Now I want those "nodereds" to run on a single executable file (each nodered project have their own .exe file) without installing node.js on a the target computer.
I found this node-pkg
But I am not just sure how am I going to implement this in my nodered project folder.
I want to retain all my user interface to be in the browser when I run the executable file created using that pkg.
The purpose of building in in one package is.
So that the user cannot edit the code in nodered
No need to install the nodejs in the target computer.
Hi, I've not tried using pkg so it would interesting if you found out
Normally I use electron - see GitHub - dceejay/electron-node-red: Electron Node-RED template - but I must admit I haven't really been maintaining it for a while so it may be well behind the curve of latest electron capability.
The idea of my app is generally only expose the dashboard view - but the editor can be enabled if needed - but that really wasn't the idea... Of course although it i a "single app" it is still really just an embedded browser instance and node engine so anyone skilled could extract the underlying flow quite easily if they knew what they were doing and where to look. But it does make it easy to install and stops casual messing around.
Have you had a go? Using my alternate install should give you the kind of config and folder structure you need to get started.
However, this seems problematic:
However your code may have require(variable) calls (so called non-literal argument to require ) or use non-javascript files (for example views, css, images etc).
Which implies that there would a LOT of work to do in order to identify all of the variable dependencies. uibuilder for example has many cases where it constructs a path to a package.json file and then imports it.
But, it would be worth just having a go and see if it works without too much config, you never know.
then I can use the .exe file on my command prompt, I just need to put --userDir arguments.
And it works just like "npm start" on your alternate-installer.
The advantage of doing this is you just have to copy the node-red-master-win.exe to any other computer along with the "data" folder. and you can run node-red on any computer
Without installing nodejs.
The downside, of course, is that you now have to regularly update, rebuild and redistribute it.
Much better, where possible, to have a server-based service with users accessing it via only a browser. In our work environment, our standards say that "thick clients" are not permitted without special permission. This is due to the cost of maintaining them. If you do have to have a thick client (perhaps because your users have to work sometimes without network access), there must be a built-in update mechanism. With a node.js based application, this is really hard to monitor and assure since a typical node.js app has many dependent packages any of which may have serious security or other issues as might node.js itself.
In its native form, it is relatively easy to assure that node.js, Node-RED and all of the other components are up-to-date.
That's good news. I last used pkg for a video streaming project (unrelated to node-red) about 3 years ago. Previously, they had issues packaging all of the files and any c++ node addons, but it had worked good enough for me. It seems they have come a long way if it can package something as complicated as node-red.
In my case, I just don't want the users to update anything on the node-red project
All programming, modules and etc are already done, and I just want them to use it "one-click" away