# \[uibuilder\] The next step - 3rd-party comms with a uibuilder front-end

**URL:** https://discourse.nodered.org/t/uibuilder-the-next-step-3rd-party-comms-with-a-uibuilder-front-end/51684
**Category:** Share Your Nodes
**Tags:** uibuilder
**Created:** [29 September 2021 20:25 UTC](https://discourse.nodered.org/t/uibuilder-the-next-step-3rd-party-comms-with-a-uibuilder-front-end/51684 "2021-09-29T20:25:51Z")
**Posts on this page:** 8
**Page:** 2

<div class="post-metadata">

### Author: ![dczysz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dczysz/32/46158_2.png) [@dczysz](https://discourse.nodered.org/u/dczysz)
#### Post date: [30 December 2021 23:16 UTC](https://discourse.nodered.org/t/uibuilder-the-next-step-3rd-party-comms-with-a-uibuilder-front-end/51684/21 "2021-12-30T23:16:30Z")

</div>

> [@TotallyInformation](#):
>
> It would be interesting to see if Node-RED was happy with things installed there though - I think it would be.

Apparently it's totally fine with that, and it fixes the `socket.io` error too. I wonder why the Node-RED docs suggest installing in `/usr/src/node-red` instead of `/data`, and if there are any downsides to copying `package.json` to `/data` and just installing there instead.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [30 December 2021 23:35 UTC](https://discourse.nodered.org/t/uibuilder-the-next-step-3rd-party-comms-with-a-uibuilder-front-end/51684/22 "2021-12-30T23:35:31Z")

</div>

> [@dczysz](#):
>
> I wonder why the Node-RED docs suggest installing in `/usr/src/node-red` instead of `/data` , and if there are any downsides to copying `package.json` to `/data` and just installing there instead.

Don't know, maybe @dceejay knows?

I can't actually think of any issues. But isn't `/usr/src/node-red` WITHIN the Docker build and therefore, if you were to upgrade it by using a new version, wouldn't the installed nodes be lost?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [31 December 2021 12:51 UTC](https://discourse.nodered.org/t/uibuilder-the-next-step-3rd-party-comms-with-a-uibuilder-front-end/51684/23 "2021-12-31T12:51:14Z")

</div>

> [@dczysz](#):
>
> I'm a bit confused on the dependency installation process. I tried to install my uibuilder dependencies from the Dockerfile ( `RUN npm install vue@2 bootstrap-vue --prefix /data/uibuilder` ) but it looks like uibuilder overwrites the package.json file upon initialization. So even though these packages were present in `/data/uibuilder/node_modules` , since package.json was now blank uibuilder warned about the missing packages when attempting to load the bootstrap-vue template.

OK, now looked again at the process and I can safely say that uibuilder **does not** destroy an existing package.json file in `<uibRoot>/`. Indeed, that wouldn't let uib work at all if it did since that is where the list of installed front-end modules now lives (it used to be in a separate file). Only if there is no package.json file in uibRoot will it create a new file. Once it has a file read in, it makes sure that it contains the required properites:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/f/bf12b1ad69a09c66d97b83c535bc69ea9a301d54.png)

The `uibuilder.packages` property gets rebuilt when NR starts and whenever a new front-end library is added or removed. Each installed dependency package is checked and its metadata rebuilt.

That means that even if you install a package manually, all you need to do is restart node-red. uib will then update itself. If you manage the packages from the library manager, you don't need to restart node-red.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [31 December 2021 15:02 UTC](https://discourse.nodered.org/t/uibuilder-the-next-step-3rd-party-comms-with-a-uibuilder-front-end/51684/24 "2021-12-31T15:02:09Z")

</div>

> [@dczysz](#):
>
> I'm also still getting the `socket.io` not found error, but messages are successfully getting passed back and forth just fine so maybe it's not actually an issue?
> 
> ```auto
> 30 Dec 19:47:48 - [warn] [uibuilder:package-mgt:getPackagePath2] PACKAGE NOT FOUND socket.io at /data/node_modules/socket.io
> 30 Dec 19:47:48 - [error] [uibuilder:web.js:serveVendorSocketIo] Cannot find install
> 
> ```

OK, I've added an extra test for this. If uib can't find [Socket.io](http://Socket.io) the usual way, it will fall back to using `require.resolve` which should then find it. I can't really test whether this works in your situation since I don't have your configuration. Hopefully though, when you update uibuilder, the error message you were getting should go away and everything should still work!

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [31 December 2021 16:34 UTC](https://discourse.nodered.org/t/uibuilder-the-next-step-3rd-party-comms-with-a-uibuilder-front-end/51684/25 "2021-12-31T16:34:52Z")

</div>

> [@dczysz](#):
>
> Bug 1:

> [@dczysz](#):
>
> Bug 2:

Both of these bugs were related and due to some dodgy logic from me. Now fixed and pushed to vNext.

The help information for the sender node has also been updated.

I think that is all of the things you've reported now sorted! 🎆 🥳

Still a few other things to complete before deployment but hopefully I'm now back on target thanks greatly to your help.

---

<div class="post-metadata">

### Author: ![dczysz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dczysz/32/46158_2.png) [@dczysz](https://discourse.nodered.org/u/dczysz)
#### Post date: [31 December 2021 17:49 UTC](https://discourse.nodered.org/t/uibuilder-the-next-step-3rd-party-comms-with-a-uibuilder-front-end/51684/26 "2021-12-31T17:49:48Z")

</div>

> [@TotallyInformation](#):
>
> I can safely say that uibuilder **does not** destroy an existing package.json file in `<uibRoot>/`

Interesting, maybe I just got things mixed up with all the testing. I was creating and destroying images/containers left and right so I wouldn't be surprised.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [1 January 2022 01:21 UTC](https://discourse.nodered.org/t/uibuilder-the-next-step-3rd-party-comms-with-a-uibuilder-front-end/51684/27 "2022-01-01T01:21:26Z")

</div>

> [@dczysz](#):
>
> Interesting, maybe I just got things mixed up with all the testing. I was creating and destroying images/containers left and right so I wouldn't be surprised.

No worries, an edge case may yet turn up but I can't see one looking at the code. However, I've added an additional warning to the log for when uibuilder does create the file.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [1 January 2022 20:06 UTC](https://discourse.nodered.org/t/uibuilder-the-next-step-3rd-party-comms-with-a-uibuilder-front-end/51684/28 "2022-01-01T20:06:21Z")

</div>

A whole bunch more fixes pushed to vNext just now. If you are having issues, please update.

[Previous page](https://discourse.nodered.org/t/uibuilder-the-next-step-3rd-party-comms-with-a-uibuilder-front-end/51684.md?page=1)
