# Save external libraries in the current version for future development

**URL:** <https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806>\
**Category:** General\
**Created:** [27 April 2021 13:45 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806 "2021-04-27T13:45:35Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giu-seppe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/giu-seppe/32/40489_2.png) [@Giu-seppe](https://discourse.nodered.org/u/Giu-seppe)\
**Post date:** [27 April 2021 13:45 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/1 "2021-04-27T13:45:35Z")

</div>

Hi everyone, i need to save some modules locally to be sure to use them in a certain version.  
Is there any way to do this?  
I'm trying to use "npm install " first taking the modules present in ".node-red / node\_modules" but I think it's not the right way to do it, could you tell me how to do it?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 April 2021 14:03 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/2 "2021-04-27T14:03:29Z")

</div>

> [@Giu-seppe](#):
>
> to be sure to use them in a certain version.

Can you give a real example of exactly what you want to achieve so that we can fully understand what you mean by that statement.

---

<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:** [27 April 2021 14:25 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/3 "2021-04-27T14:25:48Z")

</div>

npm install will use the package.lock.json file by default which has explicit module versions in it. The way to do a fully encapsulated deployment is to use the shrinkwrap feature of npm. Can't help with the details for that I'm afraid since I haven't done it for a few years.

---

<div class="post-metadata">

**Author:** ![Giu-seppe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/giu-seppe/32/40489_2.png) [@Giu-seppe](https://discourse.nodered.org/u/Giu-seppe)\
**Post date:** [27 April 2021 15:35 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/4 "2021-04-27T15:35:47Z")

</div>

I need to take external modules, for example "node-red-contrib-modbus" and install it locally, so even without an internet connection

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 April 2021 16:03 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/5 "2021-04-27T16:03:35Z")

</div>

If you search the forum for  
install nodes without internet connection  
it will find threads discussing how to do this. This one for example [[Question] Best way to install modules to an offline pc](https://discourse.nodered.org/t/question-best-way-to-install-modules-to-an-offline-pc/20902)

---

<div class="post-metadata">

**Author:** ![Giu-seppe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/giu-seppe/32/40489_2.png) [@Giu-seppe](https://discourse.nodered.org/u/Giu-seppe)\
**Post date:** [28 April 2021 09:10 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/6 "2021-04-28T09:10:39Z")

</div>

Maybe I didn't understand it well but it seems slightly different as a question, what should I do if I need to individually save each module with its dependencies and not all installed modules together ?

I tried "npm install \<path/to/folder\>".  
I got the modules from another machine with it installed

 ![Cattura](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/1/511ea8cd8cedeb7d2c5c40aa0d3205fbbbec438a.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 April 2021 09:25 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/7 "2021-04-28T09:25:10Z")

</div>

Why do you want to do that?

---

<div class="post-metadata">

**Author:** ![Giu-seppe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/giu-seppe/32/40489_2.png) [@Giu-seppe](https://discourse.nodered.org/u/Giu-seppe)\
**Post date:** [28 April 2021 09:29 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/8 "2021-04-28T09:29:14Z")

</div>

To ensure future compatibility on older installations. (I have edited the last reply with an example

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 April 2021 09:42 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/9 "2021-04-28T09:42:06Z")

</div>

In that case, if the new system does not have internet access, copy the whole node\_modules, package.json and package-lock.json from the master system to the new one.  
If the new system does have internet access then just copy the two package files across, go into the .node-red folder and run  
`npm install`  
That will install exactly the same versions as on the original system. The package lock file tells it exactly which module versions to install.  
You would also have to make sure the systems have the same node-red and nodejs versions installed.

---

<div class="post-metadata">

**Author:** ![Giu-seppe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/giu-seppe/32/40489_2.png) [@Giu-seppe](https://discourse.nodered.org/u/Giu-seppe)\
**Post date:** [28 April 2021 09:59 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/10 "2021-04-28T09:59:31Z")

</div>

Ok thanks, so I should install the whole project.  
There is a way to also save a version of node red and node.js as if they are .exe to install

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [28 April 2021 15:29 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/11 "2021-04-28T15:29:28Z")

</div>

You will need to use something like npm-bundle

> **[npm-bundle](https://www.npmjs.com/package/npm-bundle)**
>
> npm pack with dependencies included

---

<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:** [28 April 2021 21:06 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/12 "2021-04-28T21:06:25Z")

</div>

> [@Giu-seppe](#):
>
> There is a way to also save a version of node red and node.js as if they are .exe to install

You should probably choose a local install of Node-RED instead of a global one if you want that. There is an example installer in my GitHub.

---

<div class="post-metadata">

**Author:** ![Giu-seppe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/giu-seppe/32/40489_2.png) [@Giu-seppe](https://discourse.nodered.org/u/Giu-seppe)\
**Post date:** [29 April 2021 09:23 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/13 "2021-04-29T09:23:42Z")

</div>

I saw your library, I have to install my application on windows OS and has to start at every start. Shouldn't this give me some trouble?

---

<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:** [29 April 2021 16:13 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/14 "2021-04-29T16:13:41Z")

</div>

No, it works fine on Windows, I use it more there than on Linux in fact since Windows is my dev environment.

Though it has a starter script for auto-starting under Linux systemd, you have to set that up yourself anyway. I don't auto-start on Windows and use PM2 to manage things there since I can add watch folders that will auto-restart if files change.

---

<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:** [13 May 2021 16:13 UTC](https://discourse.nodered.org/t/save-external-libraries-in-the-current-version-for-future-development/44806/15 "2021-05-13T16:13:42Z")

</div>

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