# Adding dependency in container package.json

**URL:** <https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897>\
**Category:** FlowFuse\
**Tags:** docker, flowfuse\
**Created:** [5 May 2025 11:30 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897 "2025-05-05T11:30:59Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![ewuharun](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ewuharun/32/91494_2.png) [@ewuharun](https://discourse.nodered.org/u/ewuharun)\
**Post date:** [5 May 2025 11:30 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/1 "2025-05-05T11:30:59Z")

</div>

{  
"name": "node-red-project",  
"description": "A Node-RED Project",  
"version": "2.6.0",  
"private": true,  
"dependencies": {}  
}

I am copying this package.json in the /data folder and installing using npm install in docker file like below. In my image i am also installing nr-launcher package. What i know is the nr-launcher override the package.json in the /data/package.json . then if i add dependency in this file it will get override. I am looking for a solution to add dependency package in my image and that will not be override by the nr-launcher,

COPY package.json /data

WORKDIR /data

RUN npm install

USER root

RUN mkdir -p /usr/local/ssl-certs

WORKDIR /usr/src/flowforge-nr-launcher

RUN chown -R node-red:node-red /data /usr/src/flowforge-nr-launcher

USER node-red

RUN npm install @flowfuse/nr-launcher@${BUILD\_TAG}

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 May 2025 11:50 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/2 "2025-05-05T11:50:59Z")

</div>

Since you mention FlowFuse, packages are added to package.json when you either add them in the Node-RED palette manager or you add them in FlowFuse Hosted Instance settings.

---

<div class="post-metadata">

**Author:** ![ewuharun](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ewuharun/32/91494_2.png) [@ewuharun](https://discourse.nodered.org/u/ewuharun)\
**Post date:** [5 May 2025 12:08 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/3 "2025-05-05T12:08:39Z")

</div>

{  
"name": "node-red-project",  
"description": "A Node-RED Project",  
"version": "2.6.0",  
"private": true,  
"dependencies": {  
"@test/custom-node": "\*"  
}  
}

Can i add like this because i want something like this when the instance start it will install my custom-node automatically. When any instance will be created it will install this custom-node in the background and will be available in ./data/package.json.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 May 2025 12:10 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/4 "2025-05-05T12:10:22Z")

</div>

Is your custom node published on npm? Or do you use a private registry with your FlowFuse installation?

---

<div class="post-metadata">

**Author:** ![ewuharun](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ewuharun/32/91494_2.png) [@ewuharun](https://discourse.nodered.org/u/ewuharun)\
**Post date:** [5 May 2025 12:11 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/5 "2025-05-05T12:11:20Z")

</div>

I am using github private registry

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [5 May 2025 12:11 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/6 "2025-05-05T12:11:47Z")

</div>

Create a project template in flowfuse with your default packages

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 May 2025 12:12 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/7 "2025-05-05T12:12:34Z")

</div>

You need to make your node available either via npm or via a private (npm type) registry.

See: [How to Use Private Custom Nodes in FlowFuse? • FlowFuse](https://flowfuse.com/blog/2023/10/use-private-custom-nodes-with-flowfuse/)

---

<div class="post-metadata">

**Author:** ![ewuharun](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ewuharun/32/91494_2.png) [@ewuharun](https://discourse.nodered.org/u/ewuharun)\
**Post date:** [5 May 2025 12:15 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/8 "2025-05-05T12:15:31Z")

</div>

Yes i can create application template and put that in pallet dependency. But then every time i create new application template then i need to put the dependency in the application pallet dependency.

what i want in the docker image i will put my custom node in the package.json or i will install it in the ./data/package.json from the docker file. But the problem is nr-launcher overrides the package.json file and takes the package.json from application template pallet dependency.

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [5 May 2025 12:16 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/9 "2025-05-05T12:16:49Z")

</div>

Add your packages where core packages are located in node-red. Then build the image with your "custom node-red core packages"

---

<div class="post-metadata">

**Author:** ![ewuharun](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ewuharun/32/91494_2.png) [@ewuharun](https://discourse.nodered.org/u/ewuharun)\
**Post date:** [5 May 2025 12:17 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/10 "2025-05-05T12:17:20Z")

</div>

I can install the private nodes from the docker file but the problem is nr-launcher override the package.json that is in ./data/package.json. And when i inspect node\_modules in ./data/node\_modules i found my nodes is not there ony the nodes that is defined in application level template is there.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 May 2025 12:18 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/11 "2025-05-05T12:18:54Z")

</div>

Once you upload your node to npm or a private registry, you use the node-red palette manager or the instance settings -\> modules list. Then it will be added to the package file.

---

<div class="post-metadata">

**Author:** ![ewuharun](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ewuharun/32/91494_2.png) [@ewuharun](https://discourse.nodered.org/u/ewuharun)\
**Post date:** [5 May 2025 12:21 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/12 "2025-05-05T12:21:17Z")

</div>

Can you give me an example docker file?

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [5 May 2025 12:46 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/13 "2025-05-05T12:46:22Z")

</div>

Find where node-red is installed in your image. Locate its node\_modules folder. Locate @node-red/nodes/core folder. Put your nodes there. You can use a copy command in your docker image spec

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 July 2025 12:47 UTC](https://discourse.nodered.org/t/adding-dependency-in-container-package-json/96897/14 "2025-07-04T12:47:20Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
