It is not possible to update Palette Nodes (npm ERR! ENOTEMPTY: directory not empty)

When I try to update or install any new node - always is the problem like below.

-----------------------------------------------------------
2024-02-11T17:13:11.117Z Install : node-red-contrib-calc 1.0.6

2024-02-11T17:13:12.068Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-calc@1.0.6
2024-02-11T17:13:15.708Z [err] npm
2024-02-11T17:13:15.710Z [err]  
2024-02-11T17:13:15.710Z [err] WARN config production Use `--omit=dev` instead.
2024-02-11T17:13:39.627Z [err] npm
2024-02-11T17:13:39.627Z [err]  
2024-02-11T17:13:39.628Z [err] ERR!
2024-02-11T17:13:39.628Z [err]  code
2024-02-11T17:13:39.628Z [err]  ENOTEMPTY
2024-02-11T17:13:39.630Z [err] npm
2024-02-11T17:13:39.631Z [err]  ERR! syscall
2024-02-11T17:13:39.635Z [err]  rename
2024-02-11T17:13:39.635Z [err] npm ERR! path /home/openhabian/.node-red/node_modules/agentkeepalive
2024-02-11T17:13:39.636Z [err] npm 
2024-02-11T17:13:39.636Z [err] ERR! dest /home/openhabian/.node-red/node_modules/.agentkeepalive-EDRIbhsj
2024-02-11T17:13:39.638Z [err] npm
2024-02-11T17:13:39.638Z [err]  ERR! errno -39
2024-02-11T17:13:39.652Z [err] npm ERR! ENOTEMPTY: directory not empty, rename '/home/openhabian/.node-red/node_modules/agentkeepalive' -> '/home/openhabian/.node-red/node_modules/.agentkeepalive-EDRIbhsj'
2024-02-11T17:13:39.663Z [err] 
2024-02-11T17:13:39.664Z [err] npm
2024-02-11T17:13:39.665Z [err]  ERR! A complete log of this run can be found in: /home/openhabian/.npm/_logs/2024-02-11T17_13_15_309Z-debug-0.log
2024-02-11T17:13:39.719Z rc=217

Welcome to the forums @annocun

Delete the following folder: /home/openhabian/.node-red/node_modules/.agentkeepalive-EDRIbhsj (.agentkeepalive-EDRIbhsj)

and try again - Node JS has a stubborn behaviour when something it is trying todo gets stopped midway, and creates this situation.

Welcome too. I deleted folder and try to update node and below result.

2024-02-11T17:24:54.223Z Install : node-red-contrib-calc 1.0.6

2024-02-11T17:24:55.203Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-calc@1.0.6
2024-02-11T17:24:57.834Z [err] npm
2024-02-11T17:24:57.838Z [err]  
2024-02-11T17:24:57.838Z [err] WARN config production Use `--omit=dev` instead.
2024-02-11T17:25:20.082Z [err] npm ERR! code ENOTEMPTY
2024-02-11T17:25:20.082Z [err] npm ERR! syscall rename
2024-02-11T17:25:20.082Z [err] npm ERR! path /home/openhabian/.node-red/node_modules/make-dir/node_modules/semver
2024-02-11T17:25:20.082Z [err] npm ERR! dest /home/openhabian/.node-red/node_modules/make-dir/node_modules/.semver-zdIZPmDn
2024-02-11T17:25:20.082Z [err] npm ERR! errno -39
2024-02-11T17:25:20.082Z [err] npm ERR! ENOTEMPTY: directory not empty, rename '/home/openhabian/.node-red/node_modules/make-dir/node_modules/semver' -> '/home/openhabian/.node-red/node_modules/make-dir/node_modules/.semver-zdIZPmDn'
2024-02-11T17:25:20.082Z [err] 
2024-02-11T17:25:20.082Z [err] npm ERR! A complete log of this run can be found in: /home/openhabian/.npm/_logs/2024-02-11T17_24_57_424Z-debug-0.log
2024-02-11T17:25:20.086Z rc=217

Should I delete

/home/openhabian/.node-red/node_modules/make-dir/node_modules/semver

this one :point_up:

1 Like

This one.... (not semver)
And any other that looks like the same random collection of characters after the name before trying again.

If you don't, it will get stopped and create the same situation .

EDIT
Snap @Steve-Mcl

1 Like

I deleted that file and now like below:

-----------------------------------------------------------
2024-02-11T17:45:19.713Z Install : node-red-contrib-calc 1.0.6

2024-02-11T17:45:20.716Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-calc@1.0.6
2024-02-11T17:45:23.552Z [err] npm
2024-02-11T17:45:23.556Z [err]  WARN 
2024-02-11T17:45:23.557Z [err] config production Use `--omit=dev` instead.
2024-02-11T17:45:46.031Z [err] npm
2024-02-11T17:45:46.032Z [err]  
2024-02-11T17:45:46.033Z [err] ERR!
2024-02-11T17:45:46.033Z [err]  
2024-02-11T17:45:46.034Z [err] code ENOTEMPTY
2024-02-11T17:45:46.035Z [err] npm
2024-02-11T17:45:46.035Z [err]  ERR!
2024-02-11T17:45:46.036Z [err]  syscall
2024-02-11T17:45:46.036Z [err]  rename
2024-02-11T17:45:46.036Z [err] npm
2024-02-11T17:45:46.038Z [err]  
2024-02-11T17:45:46.038Z [err] ERR! path
2024-02-11T17:45:46.039Z [err]  /home/openhabian/.node-red/node_modules/node-red-node-sqlite
2024-02-11T17:45:46.041Z [err] npm 
2024-02-11T17:45:46.041Z [err] ERR! dest /home/openhabian/.node-red/node_modules/.node-red-node-sqlite-w19L5sVY
2024-02-11T17:45:46.043Z [err] npm 
2024-02-11T17:45:46.043Z [err] ERR! errno -39
2024-02-11T17:45:46.055Z [err] npm 
2024-02-11T17:45:46.055Z [err] ERR! ENOTEMPTY: directory not empty, rename '/home/openhabian/.node-red/node_modules/node-red-node-sqlite' -> '/home/openhabian/.node-red/node_modules/.node-red-node-sqlite-w19L5sVY'
2024-02-11T17:45:46.069Z [err] 
2024-02-11T17:45:46.070Z [err] npm
2024-02-11T17:45:46.070Z [err]  ERR! A complete log of this run can be found in: /home/openhabian/.npm/_logs/2024-02-11T17_45_23_133Z-debug-0.log
2024-02-11T17:45:46.119Z rc=217

Should I repeat delete with all files and random letters of each time?

I repeat it many times with different files and now

-----------------------------------------------------------
2024-02-11T17:52:54.262Z Install : node-red-contrib-calc 1.0.6

2024-02-11T17:52:55.272Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-calc@1.0.6
2024-02-11T17:52:57.940Z [err] npm
2024-02-11T17:52:57.944Z [err]  
2024-02-11T17:52:57.945Z [err] WARN config production Use `--omit=dev` instead.
2024-02-11T17:53:20.734Z [err] npm ERR! code ENOTEMPTY
2024-02-11T17:53:20.734Z [err] npm ERR! syscall rename
2024-02-11T17:53:20.734Z [err] npm ERR! path /home/openhabian/.node-red/node_modules/@mapbox/node-pre-gyp
2024-02-11T17:53:20.734Z [err] npm ERR! dest /home/openhabian/.node-red/node_modules/@mapbox/.node-pre-gyp-YqumRtlB
2024-02-11T17:53:20.734Z [err] npm ERR! errno -39
2024-02-11T17:53:20.734Z [err] npm ERR! ENOTEMPTY: directory not empty, rename '/home/openhabian/.node-red/node_modules/@mapbox/node-pre-gyp' -> '/home/openhabian/.node-red/node_modules/@mapbox/.node-pre-gyp-YqumRtlB'
2024-02-11T17:53:20.734Z [err] 
2024-02-11T17:53:20.734Z [err] npm ERR! A complete log of this run can be found in: /home/openhabian/.npm/_logs/2024-02-11T17_52_57_551Z-debug-0.log
2024-02-11T17:53:20.737Z rc=217

-----------------------------------------------------------
2024-02-11T17:54:35.716Z Install : node-red-contrib-calc 1.0.6

2024-02-11T17:54:36.721Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-calc@1.0.6
2024-02-11T17:54:39.158Z [err] npm WARN config production Use `--omit=dev` instead.
2024-02-11T17:55:08.416Z [err] npm WARN deprecated node-pre-gyp@0.12.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
2024-02-11T17:55:08.969Z [err] npm
2024-02-11T17:55:08.982Z [err]  
2024-02-11T17:55:08.982Z [err] ERR!
2024-02-11T17:55:08.983Z [err]  
2024-02-11T17:55:08.984Z [err] code ERR_INVALID_ARG_TYPE
2024-02-11T17:55:09.047Z [err] npm
2024-02-11T17:55:09.048Z [err]  
2024-02-11T17:55:09.055Z [err] ERR! The "from" argument must be of type string. Received undefined
2024-02-11T17:55:09.066Z [err] 
2024-02-11T17:55:09.068Z [err] npm ERR! A complete log of this run can be found in: /home/openhabian/.npm/_logs/2024-02-11T17_54_38_728Z-debug-0.log
2024-02-11T17:55:09.142Z rc=1

Many (if not all) do not use openhab here - so we cant know for sure if this has something todo with it.

But one thing to try...

And note: this is just advice - its upto you to try it (back up if you really need to)

  1. Stop Node RED
  2. Delete the folder /home/openhabian/.node-red/node_modules (this will remove all folders)
    (NOT the .node-red folder)
  3. within the folder : /home/openhabian/.node-red
    issue npm install
  4. Restart Node RED

This will wipe and re-install all nodes to latest version.

Question: Do you ever interrupt NPM in the middle of installing? (e.g. pressing ctrl+c or stopping node-red as installations are occuring?) - this can cause the artifacts you see.

Try this command (from your .node-red folder)

cd /home/openhabian/.node-red
npm cache clean –force
1 Like

I have an error Argument starts with non-ascii dash with:

Change with that :

npm cache clean --force

, is better. :wink:

1 Like

There seems to be another sudden spurt in the prevalence of this problem. Is something going on I wonder.
I can't understand why npm still doesn't survive the presence of these old temporary files. It has been an intermittent problem for years I think.

Definitely a spike recently. Open to ideas.

Maybe we need to consider intercepting and interpreting the occurrence in node-red and offer to run the clean cache command?