Not able to uninstall module from Palette "unknown module: node-red-contrib-play-audio"

Hi there!

I please need some advise on how to get a module uninstalled, if - in my case - the palette manager says "Failed to remove: node-red-contrib-play-audio / unknown module: node-red-contrib-play-audio".

The log only tells

2024-02-14T08:25:38.862Z Remove : node-red-contrib-play-audio

...and nothing else...

In the meantime I (think, I) uninstalled the module via npm, but node-red continues to show the module in the palette.
Can anyone help me out?

Thanks!
Florian

Assuming that you have a conventional install of node-red then go into your .node-red folder and run
npm remove node-red-contrib-play-audio
Copy/paste the full output please, including the line where you typed the command.
Then restart node-red and see if it is still there.

Hi Colin,

it's an install on a Raspi running DietPi (Debian / Raspbian) where the installation is sitting at /mnt/dietpi_userdata/node-red/

Here's the output:

dietpi@bookworm:/mnt/dietpi_userdata/node-red$ npm remove node-red-contrib-play-audio
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /mnt/dietpi_userdata/node-red/node_modules/fsevents
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/mnt/dietpi_userdata/node-red/node_modules/fsevents'
npm ERR!     at async mkdir (node:internal/fs/promises:855:10)
npm ERR!     at async /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:551:20
npm ERR!     at async Promise.allSettled (index 0)
npm ERR!     at async [reifyPackages] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:251:11)
npm ERR!     at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:170:5)
npm ERR!     at async Uninstall.exec (/usr/local/lib/node_modules/npm/lib/commands/uninstall.js:52:5)
npm ERR!     at async module.exports (/usr/local/lib/node_modules/npm/lib/cli-entry.js:61:5)
npm ERR!  Error: EACCES: permission denied, mkdir '/mnt/dietpi_userdata/node-red/node_modules/fsevents'
npm ERR!     at async mkdir (node:internal/fs/promises:855:10)
npm ERR!     at async /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:551:20
npm ERR!     at async Promise.allSettled (index 0)
npm ERR!     at async [reifyPackages] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:251:11)
npm ERR!     at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:170:5)
npm ERR!     at async Uninstall.exec (/usr/local/lib/node_modules/npm/lib/commands/uninstall.js:52:5)
npm ERR!     at async module.exports (/usr/local/lib/node_modules/npm/lib/cli-entry.js:61:5) {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/mnt/dietpi_userdata/node-red/node_modules/fsevents'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: /home/dietpi/.npm/_logs/2024-02-15T07_42_52_701Z-debug-0.log
dietpi@bookworm:/mnt/dietpi_userdata/node-red$

I then tried it again with sudo:

dietpi@bookworm:/mnt/dietpi_userdata/node-red$ sudo npm remove node-red-contrib-play-audio

up to date, audited 1486 packages in 18s

134 packages are looking for funding
  run `npm fund` for details

24 vulnerabilities (16 moderate, 8 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
dietpi@bookworm:/mnt/dietpi_userdata/node-red$ sudo systemctl restart node-red.service

...and it is still there... :frowning:

Contrib nodes are typically not installed in the installation directory. They are normally installed in the user directory. The node-red user directory by looking at The startup log. Typically though it is ~/.node-red

Try

cd ~/.node-red
npm remove node-red-contrib-play-audio

Also, in case you installed it globally do this too

sudo npm remove -g node-red-contrib-play-audio

Is that the folder where your node red flows file is?

Yes. And there it is inside the projects/projectname subfolder.
That's where I get it installed via dietpi-software...

Can you show us the output in the command window when you stop and restart node red please. It should start with Welcome to node red.

I assume that you did not install node-red using the recommended method for diet-pi. Running on Raspberry Pi : Node-RED

Here you are...

Feb 15 11:16:18 bookworm node-red[18685]: Willkommen bei Node-RED
Feb 15 11:16:18 bookworm node-red[18685]: ===================
Feb 15 11:16:18 bookworm node-red[18685]: 15 Feb 11:16:18 - [info] Node-RED Version: v3.1.3
Feb 15 11:16:18 bookworm node-red[18685]: 15 Feb 11:16:18 - [info] Node.js  Version: v21.6.1
Feb 15 11:16:18 bookworm node-red[18685]: 15 Feb 11:16:18 - [info] Linux 6.1.21-v8+ arm64 LE
Feb 15 11:16:19 bookworm node-red[18685]: 15 Feb 11:16:19 - [info] Paletten-Nodes werden geladen
Feb 15 11:16:22 bookworm node-red[18685]: 15 Feb 11:16:22 - [info] Dashboard version 3.6.2 started at /UI-22-SEMD
Feb 15 11:16:23 bookworm node-red[18685]: (node:18685) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
Feb 15 11:16:23 bookworm node-red[18685]: (Use `node --trace-deprecation ...` to show where the warning was created)
Feb 15 11:16:23 bookworm node-red[18685]: 15 Feb 11:16:23 - [info] Einstellungsdatei: /mnt/dietpi_userdata/node-red/settings.js
Feb 15 11:16:23 bookworm node-red[18685]: 15 Feb 11:16:23 - [info] Kontextspeicher: default [module=memory]
Feb 15 11:16:23 bookworm node-red[18685]: 15 Feb 11:16:23 - [info] Benutzerverzeichnis: /mnt/dietpi_userdata/node-red
Feb 15 11:16:23 bookworm node-red[18685]: 15 Feb 11:16:23 - [info] Projektverzeichnis: /mnt/dietpi_userdata/node-red/projects
Feb 15 11:16:23 bookworm node-red[18685]: 15 Feb 11:16:23 - [info] Server wird jetzt auf https://127.0.0.1:1880/Admin/ ausgeführt
Feb 15 11:16:23 bookworm node-red[18685]: 15 Feb 11:16:23 - [info] Aktives Projekt: gema
Feb 15 11:16:23 bookworm node-red[18685]: 15 Feb 11:16:23 - [info] Flow-Datei: /mnt/dietpi_userdata/node-red/projects/gema/flows.json
Feb 15 11:16:23 bookworm node-red[18685]: 15 Feb 11:16:23 - [warn] Verschlüsselte Credentials nicht gefunden
Feb 15 11:16:23 bookworm node-red[18685]: 15 Feb 11:16:23 - [info] Flows werden gestartet
Feb 15 11:16:23 bookworm node-red[18685]: 15 Feb 11:16:23 - [info] Flows sind gestartet

Yes, that's true.

It isn't possible to run this script on dietpi since the system recognizes the platform and tells me to use "dietpi-software" and stops.

dietpi-software manages the installation process itself.

That's also the reason why the platform is running node v21.6.1 and not the recommended version... but it's the distribution that - in my opinion - is running best for my purposes. It is a nice and lean distribution.

That is odd, as it says on that page that it is suitable for diet-pi. Perhaps the doc is out of date.

Go into

That means that the user dietpi has not got full write permissions into the node_modules folder, possibly because you used sudo to install a node at some point. Probably there are some root owned folders or files there. I suggest you ensure that all files and folders in dietpi_userdata are owned by dietpi and try again.

I am not sure, but maybe last time I only tried the script once, and it stopped. I didn't try to install it via apt-get... Think I have to give it a second chance...

Okay - I will try to ensure the correct ownership and try again. Thanks for that hint.