Closed nandlab closed 5 months ago
Hmm, interesting. The absolute path is actually a consequence of using Node.js's join
function to ensure safe, cross-platform file paths. If it were to be made into a path relative to the uibRoot
folder, when you copied to a new location, it still wouldn't work because you wouldn't actually have those packages installed (in <uibRoot>/node_modules/
) and you would still have to install them.
In fact, what should really happen is that uibuilder should check whether its packages actually exist when Node-RED starts - in fact, I thought it did. And if they don't exist, it should warn you and empty the list.
It should, in fact, check on startup whether there is any difference between the actual installed packages and the list.
OK, so your issue sent me down a load of rabbit holes! 😁
That was good though because that part of the code really did need an update (or 20).
This has resulted in extensive reworking of the package management code for v7 and hopefully the removal of a number of edge-case bugs.
What it hasn't - yet - done is fix your direct issue.
However, what I have done is to make sure that any discrepancies between what is actually installed in <uibRoot>/node_modules/
and <uibRoot>/package.json
is highlighted as a warning in the Node-RED log and also in the debug panel. So at least you will know that something needs to be done.
That warning will appear on startup but also whenever you install or remove a library via the uibuilder library manager tab.
On the backlog for a future release are some thoughts about automating the process of fixing discrepancies. This might have unintended consequences however, so more thought is required before I implement something.
PS: The <uibRoot>/package.json
file is updated by several processes in uibuilder since the most common use-case is for people to be managing installations using the library manager tab.
Clearly, in your case, you don't perhaps want people to do this. In your specific case, the best workaround would be to move the uibRoot folder to a common location - perhaps one that is just read-only to Node-RED - you can do that in settings.js under the uibuilder section. Then, because you have a common location and because you are using Linux, the filing system name of the folder won't change.
Thank you for working on this! It would be very convenient, if the uibuilder node_modules
can be somehow reinstalled when cloning the Node-RED project on a new machine.
Closing this for now. Request is on the backlog for a future enhancement.
Current Behavior
When I clone my Node-RED project on another machine with a different
.node-red
path, theuibuilder.packages.vue.installFolder
property changes in thepackage.json
of uibuilder creating an unnecessary diff in the version control of the project.Expected Behavior
It would be better if the
installFolder
property was a local path relative to the uibuilder directory. That way cloning a Node-RED project on another system would not directly modify a file.Steps To Reproduce
Example Node-RED flow
No response
Environment
How is Node-RED installed? Globally with npm.
How/where is UIBUILDER installed? Installed in
~/.node-red/node_modules/node-red-contrib-uibuilder
using palette manager.Have you changed any of the
uibuilder
settings in yoursettings.js
file? No.package.json
in uibuilder: