ENOTEMPTY when installing node from palette since nodered 3.0 (directory not empty)

my english is bad...
i have nodered in docker
since the new version (3.0.0) i can't add new palets or update existing palet.
i have this message in log :slight_smile:

2022-08-03T11:41:30.188Z Install : node-red-contrib-rfxcom 2.11.3

2022-08-03T11:41:32.206Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-rfxcom@2.11.3
2022-08-03T11:41:33.958Z [err] npm
2022-08-03T11:41:33.959Z [err]  WARN 
2022-08-03T11:41:33.959Z [err] config production Use `--omit=dev` instead.
2022-08-03T11:41:56.942Z [err] npm
2022-08-03T11:41:56.942Z [err]  ERR!
2022-08-03T11:41:56.942Z [err]  code
2022-08-03T11:41:56.943Z [err]  ENOTEMPTY
2022-08-03T11:41:56.943Z [err] npm ERR!
2022-08-03T11:41:56.943Z [err]  syscall rename
2022-08-03T11:41:56.944Z [err] npm
2022-08-03T11:41:56.944Z [err]  ERR! path /data/node_modules/marked
2022-08-03T11:41:56.944Z [err] npm ERR! dest /data/node_modules/.marked-zxF1Vjah
2022-08-03T11:41:56.945Z [err] npm ERR! 
2022-08-03T11:41:56.946Z [err] errno -39
2022-08-03T11:41:56.949Z [err] npm ERR! ENOTEMPTY: directory not empty, rename '/data/node_modules/marked' -> '/data/node_modules/.marked-zxF1Vjah'
2022-08-03T11:41:56.954Z [err] 
2022-08-03T11:41:56.955Z [err] npm ERR! A complete log of this run can be found in:
2022-08-03T11:41:56.955Z [err] npm ERR!     /data/.npm/_logs/2022-08-03T11_41_33_829Z-debug-0.log
2022-08-03T11:41:57.026Z rc=217

I am experiencing this as well both with node-red 2.2.2 and after upgrading to 3.0.2. Palette manager shows 2 nodes with available updates:
node-red-node-email from 1.15.1 to 1.17.0
node-red-node-snmp from 1.0.1 to 1.0.2

I receive similar ENOTEMPTY errors for both:

2022-08-04T15:09:29.165Z Install : node-red-node-email 1.17.0
2022-08-04T15:09:29.854Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-node-email@1.17.0
2022-08-04T15:09:30.884Z [err] npm
2022-08-04T15:09:30.885Z [err]  WARN
2022-08-04T15:09:30.885Z [err]  config production Use `--omit=dev` instead.
2022-08-04T15:09:32.149Z [err] npm ERR! code ENOTEMPTY
2022-08-04T15:09:32.149Z [err] npm
2022-08-04T15:09:32.149Z [err]  ERR! syscall rename
2022-08-04T15:09:32.150Z [err] npm 
2022-08-04T15:09:32.150Z [err] ERR! 
2022-08-04T15:09:32.150Z [err] path
2022-08-04T15:09:32.150Z [err]  /home/pi/.node-red/node_modules/node-red-node-email
2022-08-04T15:09:32.150Z [err] npm 
2022-08-04T15:09:32.150Z [err] ERR! dest /home/pi/.node-red/node_modules/.node-red-node-email-eJQ2YdZ0
2022-08-04T15:09:32.151Z [err] npm ERR!
2022-08-04T15:09:32.151Z [err]  errno -39
2022-08-04T15:09:32.153Z [err] npm ERR!
2022-08-04T15:09:32.154Z [err]  ENOTEMPTY: directory not empty, rename '/home/pi/.node-red/node_modules/node-red-node-email' -> '/home/pi/.node-red/node_modules/.node-red-node-email-eJQ2YdZ0'
2022-08-04T15:09:32.156Z [err] 
2022-08-04T15:09:32.157Z [err] npm 
2022-08-04T15:09:32.157Z [err] ERR! A complete log of this run can be found in:
2022-08-04T15:09:32.157Z [err] npm ERR!     /home/pi/.npm/_logs/2022-08-04T15_09_30_808Z-debug-0.log
2022-08-04T15:09:32.166Z rc=217

Here are system details:

HardwareRaspberry Pi 4 Model B Rev 1.2 CPU: 4xARMv7 RAM: 3930868kB
EEPROM Bootloader Thu 10 Mar 2022 11:57:12 AM UTC (1646913432)
EEPROM Firmware 000138a1
Linux Kernel Linux NetMon 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l GNU/Linux
Operating System Raspbian GNU/Linux 10 (buster) version 10.12
Node-RED Version v2.2.2
Node.js Version v16.16.0
npm Version 8.11.0
SQLite Version 3.34.0



I don't know why this is happening recently, but I think if you delete that folder it will be ok.

Seems to be a trend here that I'm noticing.

Yes, something must be going on behind the scenes. Possibly an npm change.

Most odd indeed. Weird it mostly seems to be around the email node.

Yeah, I noticed that but then this OP's post makes me think something else going on...

I know marked is a dependency in node-red. So this is slightly different (and still odd)

1 Like

If it’s in the core then why is this in the user (data/) node_modules area ?

Dont know Dave - just saying that I know marked is a dependency - so the whole situation of adding (the email node) may not be the cause.

I suppose the difference in the 2 posts in this thread is the OP's is a docker install and the 2nd issue is a PI install.

I cant piece it together from the info floating around.

Indeed. Likewise. And of course “it worked for me”. Tricky. Just have to keep an eye open.


I noticed exactly the same. when I updated the email node about 2 weeks ago from version 1.15.1 to 1.17.0. My NR instance doesn't run in a Docker container, but just on a Raspberry Pi.

The first try to update from the palette failed, so I moved to the CLI and tried again.
It ended with a same error as described above. A hidden .node-red-node-email-XXXXXX
My first thought was similar to what @Colin suggested. Delete that directory.
Tried again and it returned with an error and another hidden dierectory has to be deleted.
This happened a few times. A check turned out, that there were more hidden directories in the node_modules directory. So how many to go?

I decided to delete the node_modules directory and to re-install my modules.
Afterwards I could install the email node without problems.
It happened to me on one of my two Raspberries, where these nodes has been installed.

The second one did not contain hidden directories and there the email node installed without issues.


Oddness... When I try to update node-red-node-snmp, it was still the same email node file that is complained about:

2022-08-04T17:14:41.066Z Install : node-red-node-snmp 1.0.2
2022-08-04T17:14:41.804Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-node-snmp@1.0.2
2022-08-04T17:14:42.814Z [err] npm
2022-08-04T17:14:42.815Z [err]  WARN
2022-08-04T17:14:42.815Z [err]  config production Use `--omit=dev` instead.
2022-08-04T17:14:45.377Z [err] npm
2022-08-04T17:14:45.377Z [err]  ERR!
2022-08-04T17:14:45.378Z [err]  
2022-08-04T17:14:45.378Z [err] code ENOTEMPTY
2022-08-04T17:14:45.378Z [err] npm 
2022-08-04T17:14:45.378Z [err] ERR! syscall rename
2022-08-04T17:14:45.379Z [err] npm
2022-08-04T17:14:45.379Z [err]  ERR! path /home/pi/.node-red/node_modules/node-red-node-email
2022-08-04T17:14:45.379Z [err] npm 
2022-08-04T17:14:45.379Z [err] ERR! dest /home/pi/.node-red/node_modules/.node-red-node-email-eJQ2YdZ0
2022-08-04T17:14:45.379Z [err] npm 
2022-08-04T17:14:45.380Z [err] ERR! 
2022-08-04T17:14:45.380Z [err] errno -39
2022-08-04T17:14:45.382Z [err] npm ERR!
2022-08-04T17:14:45.382Z [err]  ENOTEMPTY: directory not empty, rename '/home/pi/.node-red/node_modules/node-red-node-email' -> '/home/pi/.node-red/node_modules/.node-red-node-email-eJQ2YdZ0'
2022-08-04T17:14:45.385Z [err] 
2022-08-04T17:14:45.386Z [err] npm 
2022-08-04T17:14:45.386Z [err] ERR! A complete log of this run can be found in:
2022-08-04T17:14:45.386Z [err] npm ERR!     /home/pi/.npm/_logs/2022-08-04T17_14_42_748Z-debug-0.log
2022-08-04T17:14:45.395Z rc=217

I deleted directory /home/pi/.node-red/node_modules/.node-red-node-email-eJQ2YdZ0, rebooted, and then could run both node updates successfully.

I successfully updated the email and snmp nodes this way on both node-red 2.2.2 and 3.0.2. (I have my applications installed on both as I am still testing 3.0.2.)


Others are encountering this issue too.

and numerous others, but so far have not found any information about what might be triggering it.

on complement off my post about this problem :
1/ my configuration is not on a Pi, it's on a PC with amd sempro 2 x 2100 with 6 go of ram and an hd of 250 Go ant os is ubuntu 22.04 lts
2/ nodered is in a container docker
3/ my problem is not only with palette rfxcom but for all new palette or update, since nodered was update in 3.0 with watchtower (other container of docker)

Is it ok once you delete the folder?

Problem on all node updates in 3.0 and above.

2022-08-08T17:11:21.389Z Install : node-red-contrib-bigtimer 2.8.2

2022-08-08T17:11:21.196Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-bigtimer@2.8.2

2022-08-08T17:11:22.771Z [err] npm

2022-08-08T17:11:22.772Z [err]

2022-08-08T17:11:22.773Z [err] WARN

2022-08-08T17:11:22.773Z [err]

2022-08-08T17:11:22.773Z [err] config

2022-08-08T17:11:22.773Z [err] production Use --omit=dev instead.

2022-08-08T17:11:31.161Z [err] npm

2022-08-08T17:11:31.161Z [err]

2022-08-08T17:11:31.161Z [err] ERR!

2022-08-08T17:11:31.162Z [err]

2022-08-08T17:11:31.162Z [err] code

2022-08-08T17:11:31.162Z [err] ENOTEMPTY

2022-08-08T17:11:31.162Z [err] npm

2022-08-08T17:11:31.162Z [err]

2022-08-08T17:11:31.163Z [err] ERR!

2022-08-08T17:11:31.163Z [err]

2022-08-08T17:11:31.163Z [err] syscall

2022-08-08T17:11:31.163Z [err] rename

2022-08-08T17:11:31.163Z [err] npm

2022-08-08T17:11:31.163Z [err]

2022-08-08T17:11:31.163Z [err] ERR!

2022-08-08T17:11:31.163Z [err]

2022-08-08T17:11:31.164Z [err] path

2022-08-08T17:11:31.164Z [err] /config/node-red/node_modules/agent-base

2022-08-08T17:11:31.164Z [err] npm

2022-08-08T17:11:31.164Z [err]

2022-08-08T17:11:31.164Z [err] ERR!

2022-08-08T17:11:31.164Z [err]

2022-08-08T17:11:31.164Z [err] dest

2022-08-08T17:11:31.164Z [err] /config/node-red/node_modules/.agent-base-MyGAUl8n

2022-08-08T17:11:31.165Z [err] npm

2022-08-08T17:11:31.165Z [err]

2022-08-08T17:11:31.165Z [err] ERR!

2022-08-08T17:11:31.165Z [err]

2022-08-08T17:11:31.165Z [err] errno

2022-08-08T17:11:31.165Z [err] -39

2022-08-08T17:11:31.169Z [err] npm

2022-08-08T17:11:31.169Z [err]

2022-08-08T17:11:31.169Z [err] ERR!

2022-08-08T17:11:31.169Z [err] ENOTEMPTY: directory not empty, rename '/config/node-red/node_modules/agent-base' -> '/config/node-red/node_modules/.agent-base-MyGAUl8n'

2022-08-08T17:11:31.171Z [err]

2022-08-08T17:11:31.172Z [err] npm

2022-08-08T17:11:31.172Z [err]

2022-08-08T17:11:31.172Z [err] ERR!

2022-08-08T17:11:31.172Z [err] A complete log of this run can be found in:

2022-08-08T17:11:31.172Z [err] npm

2022-08-08T17:11:31.172Z [err]

2022-08-08T17:11:31.172Z [err] ERR!

2022-08-08T17:11:31.172Z [err] /root/.npm/_logs/2022-08-08T17_11_22_666Z-debug-0.log

2022-08-08T17:11:31.198Z rc=217

This is an npm problem that pops up occasionally and no one knows why. Delete the folder mentioned and try again. It should be ok.

Though why you are installing there I don't know.

what folder i must delete and where he is ?
i don't find it......

It says it is /config/node-red/node_modules/.agent-base-MyGAUl8n but that is a bit odd I have to admit. What hardware/os are you running on and how did you install node-red?

Yes sorry, node-red is installed in Home Assistant on a virtual machine. I know were that folder is and will rename it in case something goes wrong. I will test this tomorrow when I have some time. Thanks for your help.