# How to install node offline using node-red Admin API

**URL:** https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995
**Category:** General
**Created:** [28 April 2023 07:45 UTC](https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995 "2023-04-28T07:45:24Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![jayashree](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@jayashree](https://discourse.nodered.org/u/jayashree)
#### Post date: [28 April 2023 07:45 UTC](https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995/1 "2023-04-28T07:45:24Z")

</div>

I am trying to install nodes in node-red without internet (offline). I have npm pack file (.tgz) and trying to install use admin method "/nodes" POST ([POST /nodes : Node-RED](https://nodered.org/docs/api/admin/methods/post/nodes/)), but "I am getting module not found error".

I tried few things :

1. I extracted the .tgz file and gave path to package.json of nodes.
2. I tried to give the path of dir where the package.json is present.
3. I didn't extract it and gave path of .tgz file. (I know it will not work according to doc)

can anyone please suggest what I am doing wrong here or any other alternative method ?

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [28 April 2023 09:02 UTC](https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995/2 "2023-04-28T09:02:48Z")

</div>

Welcome to the forums @jayashree.

I think you mileage is going to vary.

You can install NPM packages with no internet, really easily:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/e/9ea9e6bad48ac2412f545edfdc3cc10742ccb8ce.png)

The problem you will face, is when those packages have dependencies, NPM will try and pull them down from the NPM registry.

You options are:

- Go for a dependency walk (Good Luck)
- Install all nodes you need, on a machine WITH internet, then move the `node_modules` folder over, but if the platform architectures are different - you going to have issues with Native modules, you can rebuild them however, so maybe not so much of a problem.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [28 April 2023 09:48 UTC](https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995/3 "2023-04-28T09:48:48Z")

</div>

@marcus-j-davies the npm pack file will contain everything needed.

@jayashree You need to include the file contents in the HTTP post request under a property called 'tarball':

The following curl command does the job.

```auto
curl -F tarball=@node-red-node-random-0.4.1.tgz http://localhost:1880/nodes

```

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [28 April 2023 10:50 UTC](https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995/4 "2023-04-28T10:50:38Z")

</div>

> [@knolleary](#):
>
> @marcus-j-davies the npm pack file will contain everything needed.

Hi @knolleary

So if I pull a `tgz` from NPM, example: [https://registry.npmjs.org/node-red/-/node-red-3.0.2.tgz](https://registry.npmjs.org/node-red/-/node-red-3.0.2.tgz)

The `tgz` also includes all dependencies required by node-red-3.0.2, and therefore will not need to fetch anything further from NPM?

**EDIT**  
I had to check this, as I didn't think NPM will do that, the content suggests it doesn't  
unless Nodes are somehow packaged differently ?

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

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [28 April 2023 11:05 UTC](https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995/5 "2023-04-28T11:05:35Z")

</div>

> [@marcus-j-davies](#):
>
> The `tgz` also includes all dependencies required by node-red-3.0.2, and therefore will not need to fetch anything further from NPM?

No. I forgot the key part needed - to add a `bundleDependencies` section to the package.json:

> **[package.json | npm Docs](https://docs.npmjs.com/cli/v9/configuring-npm/package-json/)**
>
> Specifics of npm's package.json handling

I realise I tests the curl command using a node that had no dependencies.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [28 April 2023 11:06 UTC](https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995/6 "2023-04-28T11:06:27Z")

</div>

In general, I don't think nodes should be including a 'bundleDependencies' themselves... but if you're in a position of needing to pack them for offline install, you'll need to do the work to ensure the dependencies get included.

---

<div class="post-metadata">

### Author: ![jayashree](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@jayashree](https://discourse.nodered.org/u/jayashree)
#### Post date: [3 May 2023 10:14 UTC](https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995/7 "2023-05-03T10:14:15Z")

</div>

Thank you for the solution,

But some nodes are installing and for some nodes sometimes i'm getting **{"code":"unexpected\_error","message":"Install failed"}** , it is sporadic not everytime, for 4 to 5 times it is failing and if i try again node is installing, sometimes if i try continuosly 10 to 15 times also node is not installing(tries with /node-red-contrib-enigma-0.0.1.tgz node).

Can you please suggest me how i can resolve this issue? and how much size it will support to install offline(will it support all the nodes).

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [3 May 2023 11:03 UTC](https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995/8 "2023-05-03T11:03:36Z")

</div>

You'd have to check the node-red logs for any further information - although they may not have much there.

Otherwise, we'd have to try to debug it to see what exactly is happening.

---

<div class="post-metadata">

### Author: ![jayashree](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@jayashree](https://discourse.nodered.org/u/jayashree)
#### Post date: [5 June 2023 08:26 UTC](https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995/9 "2023-06-05T08:26:32Z")

</div>

do we need to include only dependencies in bundleDependencies to pack the node or we need to add other things as well?

---

<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 August 2023 08:26 UTC](https://discourse.nodered.org/t/how-to-install-node-offline-using-node-red-admin-api/77995/10 "2023-08-04T08:26:53Z")

</div>

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