# Steps to create a custom node package for offline installation

**URL:** https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624
**Category:** Share Your Projects
**Created:** [23 December 2021 20:04 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624 "2021-12-23T20:04:48Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [23 December 2021 20:04 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/1 "2021-12-23T20:04:48Z")

</div>

Hi folks,

I am absolutely _ **not** _ an NPM expert, so I had some trouble to help @bogi in another [discussion](https://discourse.nodered.org/t/node-red-contrib-drawsvg-when-using-docker-iotstack/55450). He needed to have a package of my custom node to install it in an offline Node-RED system. Don't know if my way of working is complete or solid, but it seemed to work for me. So sharing the steps I have executed to create such an _**offline package (containing all dependencies)**_:

1. Since `npm pack` doesn't [seem](https://github.com/npm/npm/issues/4210) to include the node dependencies inside the package, I installed the [npm-pack-all](https://github.com/kleingtm/npm-pack-all#readme) package globally:

2. Then I had to install my custom node _ **globally** _ (-g):

3. Navigate to the custom node folder via command line:

4. Build a package from within the custom node folder:

5. A few seconds later the tgz archive file will be created:

6. Now uninstall the global custom node package again, to avoid conflicts/headache afterwards:

7. Test the package, by opening the _"Manage palette"_ of your Node-RED (which doesn't hav the custom node installed yet!), and navigate to the tgz file and upload it:

8. If everything goes well, the custom node should become available in the palette to use it in your flows:

Hopefully this can help other people with offline installations.

Bart

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [23 December 2021 20:41 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/2 "2021-12-23T20:41:49Z")

</div>

Hi Bart - as I replied in another thread - you can use the normal npm pack as long as you add the dependencies to a `bundleddependencies` section of your package.json - and run `npm i` locally before running `npm pack` (which usually I have done while developing a node anyway) . Not ideal if this means you end up creating two versions of your node (one with and one without dependencies) - and of course it doesn't then let npm try to optimise the installed libraries to reduce size - but for offline work it does work.

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [23 December 2021 21:37 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/3 "2021-12-23T21:37:21Z")

</div>

Hi Dave,  
Thanks for sharing that alternative!  
I had also seen that `bundleddependencies´ tonight, but I wasn't sure whether that also works for nested dependencies? Suppose my node depends - via bundleddependencies - on package A, but package A depends in turn on another package B. Does this mean that package A also needs to use bundleddependencies for package B? I assume not, because then it would become hopeless to manage the entire dependency tree...

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [23 December 2021 21:50 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/4 "2021-12-23T21:50:39Z")

</div>

> [@dceejay](#):
>
> as I replied in another thread

Ah ok, I see now that Bogi also mentioned that same tgz file in that other discussion...

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [23 December 2021 22:12 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/5 "2021-12-23T22:12:09Z")

</div>

It seems to work for me if I specify the top level other libraries I need. (And run npm install) so they are all loaded locally. That seems to then pack up the sub-dependencies also.

---

<div class="post-metadata">

### Author: ![Asad.Khan](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@Asad.Khan](https://discourse.nodered.org/u/Asad.Khan)
#### Post date: [12 September 2022 11:35 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/6 "2022-09-12T11:35:30Z")

</div>

Hy BartButenaers, thanks for this info it helped me alot, i am also new to NODE-RED and NPM. By following the process you have mentioned I am able to upload few modules using tgz file. But i am facing issue with some modules.

I am facing issue in installing these nodes [GitHub - okhiroyuki/red-mobile-nodes: Extra nodes for RedMobile](https://github.com/okhiroyuki/red-mobile-nodes) using a tgz file file. Could you please help me with it. I am also facing issue in generating a module using NPM run build as mentioned in this tutorial : [GitHub - okhiroyuki/redmobile-modules-generator: Node Modules generator for customizing RedMobile's Node-RED](https://github.com/okhiroyuki/redmobile-modules-generator)

 ![redmobile issue](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/b/cb27e08b08f44c953d2b6e2e88c55a17f6f9f91d.png)

---

<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: [12 September 2022 13:18 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/7 "2022-09-12T13:18:35Z")

</div>

> [@Asad.Khan](#):
>
> I am facing issue in installing these nodes [GitHub - okhiroyuki/red-mobile-nodes: Extra nodes for RedMobile](https://github.com/okhiroyuki/red-mobile-nodes)

> [@Asad.Khan](#):
>
> ![redmobile issue](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/b/cb27e08b08f44c953d2b6e2e88c55a17f6f9f91d.png)

The name of the package is `@red-mobile/red-mobile-nodes` not `red-mobile-nodes`

See here: [@red-mobile/red-mobile-nodes - npm](https://www.npmjs.com/package/@red-mobile/red-mobile-nodes)

---

<div class="post-metadata">

### Author: ![Asad.Khan](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@Asad.Khan](https://discourse.nodered.org/u/Asad.Khan)
#### Post date: [13 September 2022 07:35 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/8 "2022-09-13T07:35:46Z")

</div>

> [@Steve-Mcl](#):
>
> @red-mobile/red-mobile-nodes

Thanks it worked, Could you please see the issue in this tutorial of Node-red module generator: [GitHub - okhiroyuki/redmobile-modules-generator: Node Modules generator for customizing RedMobile's Node-RED](https://github.com/okhiroyuki/redmobile-modules-generator)  
npm run build doesn't work and publish following error

 ![redmobile module generator issue 1.1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/4/e4d8c222b5b20ad86fdc46398de967d80598de6c.png)

---

<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: [13 September 2022 07:38 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/9 "2022-09-13T07:38:02Z")

</div>

> [@Asad.Khan](#):
>
> npm run build doesn't work and publish following error

you are in the wrong directory.

go back up to the redmobile folder and try again

---

<div class="post-metadata">

### Author: ![Asad.Khan](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@Asad.Khan](https://discourse.nodered.org/u/Asad.Khan)
#### Post date: [13 September 2022 08:38 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/10 "2022-09-13T08:38:06Z")

</div>

![redmob latest](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/f/8f321d6949fee8d9978520d7d520ce2592dd742b.png)

---

<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: [13 September 2022 09:26 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/11 "2022-09-13T09:26:38Z")

</div>

I suspect you need to be 2 directories further up (in where the package.json exists)

Other than that, you will have to ask on the repositories "issues" page.

---

<div class="post-metadata">

### Author: ![Asad.Khan](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@Asad.Khan](https://discourse.nodered.org/u/Asad.Khan)
#### Post date: [13 September 2022 09:29 UTC](https://discourse.nodered.org/t/steps-to-create-a-custom-node-package-for-offline-installation/55624/12 "2022-09-13T09:29:30Z")

</div>

i have tried following the same process in all the directories where i have cloned redmobile-modules-generator. But its not working all have some issue.

 ![redmob latest folder 1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/78b35b2804094651104bde7b6c94958581791469.png)
