# Disappearing node\_modules

**URL:** <https://discourse.nodered.org/t/disappearing-node-modules/92401>\
**Category:** General\
**Tags:** docker\
**Created:** [15 October 2024 09:04 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401 "2024-10-15T09:04:45Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [15 October 2024 09:04 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/1 "2024-10-15T09:04:46Z")

</div>

Hi I have some additional modules that I use.  
i2c-bus  
ina219  
ina219-sync  
A couple of times recently these have disappeared and node red has stopped because they are called upon in settings.js  
I notice that they have been replaced as hidden files called:  
.i2c-bus-eVViQg5K  
.ina219-tsDZ2lkp  
.ina219-sync-cWMQSGw7

Why does this happen and how do I stop it.  
thanks

---

<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:** [15 October 2024 09:27 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/2 "2024-10-15T09:27:44Z")

</div>

How did you install the modules?

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [15 October 2024 09:41 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/3 "2024-10-15T09:41:52Z")

</div>

I use docker. In nodered folder:  
dbash  
cd /data  
npm install ina219

It all worked fine for a few weeks before this happened.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [15 October 2024 09:51 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/4 "2024-10-15T09:51:18Z")

</div>

How did you map the /data folder to the node red data folder when creating the container ?

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [15 October 2024 09:57 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/5 "2024-10-15T09:57:58Z")

</div>

Not sure I understand but this is a couple of lines from docker-compose.yml

```
image: nodered/node-red
volumes:
  - ./data:/data

```

---

<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:** [15 October 2024 11:26 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/6 "2024-10-15T11:26:55Z")

</div>

Tagged the thread as docker related.

---

<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:** [15 October 2024 14:30 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/7 "2024-10-15T14:30:23Z")

</div>

Do you mean that initially you see in `/data/node_modules` the folder `ina219` but later instead of that you see `/data/node_modules/.ina219-tsDZ2lkp`

Is your system accessible via the internet?

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [15 October 2024 15:04 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/8 "2024-10-15T15:04:46Z")

</div>

Yes that's correct. I have remote Tailscale access to the system. I believe it to be pretty secure

---

<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:** [15 October 2024 15:08 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/9 "2024-10-15T15:08:04Z")

</div>

> [@muggins](#):
>
> I believe it to be pretty secure

What is in those folders?

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [15 October 2024 15:28 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/10 "2024-10-15T15:28:49Z")

</div>

Not sure what you're asking. Tailscale is enabled on my GLinet router. The docker nodered container is standard with node modules and setting.js etc in the data folder.

---

<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:** [15 October 2024 15:46 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/11 "2024-10-15T15:46:48Z")

</div>

> [@muggins](#):
>
> Not sure what you're asking.

I wasn't clear, sorry. I meant what is in the strange folders?  
Also, what is in package.json before and after the rename?

It does smell of a hacked system to me, though I hear what you are saying about Tailscale.

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [15 October 2024 16:11 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/12 "2024-10-15T16:11:23Z")

</div>

The first time it happened I just renamed the altered folders back to the original and it worked again. I then made a copy of the data folder and twice since then have just restored that copy. The altered folders looked normal with nothing untoward in the package.json

---

<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:** [15 October 2024 16:17 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/13 "2024-10-15T16:17:09Z")

</div>

> [@muggins](#):
>
> The altered folders looked normal with nothing untoward in the package.json

Is package.json still asking for ina219? I would not have expected that to work when the folder has, apparently, been renamed. Or perhaps it did not work.

Have you looked into the files in the renamed folder to see if they are identical to the original? It is odd though, I cannot see why a hacker would rename the folder. Rather he would hack the contents.

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [15 October 2024 16:33 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/14 "2024-10-15T16:33:02Z")

</div>

I agree. The renamed folder still references ina219 and did not work until I renamed it to the original again. Very strange and not what a hacker would do I think. Something or someone did however make the change.  
Just to recap. Node red failed and complained of something within settings.js.  
I tracked it down to:

functionGlobalContext: {  
//os:require('os'),   
i2c:require('i2c-bus'),  
inaJM:require('ina219'),  
ina:require('ina219-sync'),  
fs:require('fs')  
},

Then I noticed that those modules were missing but spotted hidden files with similar names. I renamed the 3 files to original and all worked again.

---

<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:** [15 October 2024 16:37 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/15 "2024-10-15T16:37:15Z")

</div>

Those odd names look like the temporary folder names you get when updating a package with npm. Sometimes, npm cannot delete them for reasons I've never managed to track down.

But to me, the implication is that something tried to update the package but failed.

---

<div class="post-metadata">

**Author:** ![muggins](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muggins/32/63013_2.png) [@muggins](https://discourse.nodered.org/u/muggins)\
**Post date:** [15 October 2024 16:40 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/16 "2024-10-15T16:40:04Z")

</div>

That sounds like a reasonable conclusion. My issue now is how to stop the system doing auto upgrades as it "kills" 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:** [15 October 2024 18:35 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/17 "2024-10-15T18:35:46Z")

</div>

Well, you probably need to work out why npm is failing and fix that. It is likely to be a permissions issue I would guess. But then I don't use Docker that much so not sure what might be happening.

---

<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:** [29 October 2024 18:36 UTC](https://discourse.nodered.org/t/disappearing-node-modules/92401/18 "2024-10-29T18:36:37Z")

</div>

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