How to free up space? node uses more than 8 GB space

Hi, ideally, the yunohost tool menu would be the ideal place to make these functions accessibles to free-up space as the server operating system ages, apps are removed, functions are evolving.
I would need to fee 8GB as well (18 versions total, 8 are V18, but two apps use V16 and V22, no 18).

It says that the ideal tree is protecting the action, it contradicts the diagnostic…

npm error Tracker "idealTree" already exists

Here is the log file for the pruning command of npm -prune.

0 verbose cli /usr/local/bin/node /usr/local/bin/npm
1 info using npm@10.9.2
2 info using node@v22.14.0
3 silly config load:file:/usr/local/lib/node_modules/npm/npmrc
4 silly config load:file:/.npmrc
5 silly config load:file:/root/.npmrc
6 silly config load:file:/usr/local/etc/npmrc
7 verbose title npm prune
8 verbose argv "prune"
9 verbose logfile logs-max:10 dir:/root/.npm/_logs/2025-02-24T11_30_17_828Z-
10 verbose logfile /root/.npm/_logs/2025-02-24T11_30_17_828Z-debug-0.log
11 silly logfile start cleaning logs, removing 110 files
12 silly packumentCache heap:2197815296 maxSize:549453824 maxEntrySize:274726912
13 silly idealTree buildDeps
14 verbose stack Error: Tracker "idealTree" already exists
14 verbose stack     at #onError (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/tracker.js:84:11)
14 verbose stack     at Arborist.addTracker (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/tracker.js:26:20)
14 verbose stack     at #buildDeps (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:756:10)
14 verbose stack     at Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:181:28)
14 verbose stack     at async Arborist.prune (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1504:5)
14 verbose stack     at async Prune.exec (/usr/local/lib/node_modules/npm/lib/commands/prune.js:29:5)
14 verbose stack     at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:207:9)
14 verbose stack     at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:74:5)
15 error Tracker "idealTree" already exists
16 silly unfinished npm timer idealTree:buildDeps 1740396618096
17 verbose cwd /
18 verbose os Linux 6.1.0-31-amd64
19 verbose node v22.14.0
20 verbose npm  v10.9.2
21 verbose exit 1
22 verbose code 1
23 error A complete log of this run can be found in: /root/.npm/_logs/2025-02-24T11_30_17_828Z-debug-0.log

best

Update on this thread, we still have both locations /usr/local/n/ and /opt/node_n/n fill up with nodejs versions but only the one in opt is used. Also we still have cron somewhere auto downloading new versions but there are not applied until apps are restarted/upgraded. It’s annoying for users having small root partition.

root@home:/# ls -alh  /usr/local/n/versions/node/
total 64K
drwxr-sr-x 16 root staff 4,0K 15 mai   06:25 .
drwxr-sr-x  3 root staff 4,0K 16 nov.   2020 ..
drwxr-sr-x  6 root staff 4,0K 18 oct.   2024 12.22.12
drwxr-sr-x  6 root staff 4,0K 18 oct.   2024 14.21.3
drwxr-sr-x  6 root staff 4,0K 18 oct.   2024 16.20.2
drwxr-sr-x  6 root staff 4,0K  9 juil.  2024 20.15.1
drwxr-sr-x  6 root staff 4,0K  4 oct.   2024 20.18.0
drwxr-sr-x  6 root staff 4,0K 21 nov.  06:25 20.18.1
drwxr-sr-x  6 root staff 4,0K 22 janv. 06:25 20.18.2
drwxr-sr-x  6 root staff 4,0K 11 févr. 06:25 20.18.3
drwxr-sr-x  6 root staff 4,0K 14 mars  06:25 20.19.0
drwxr-sr-x  6 root staff 4,0K 23 avril 06:25 20.19.1
drwxr-sr-x  6 root staff 4,0K 15 mai   06:25 20.19.2
drwxr-sr-x  6 root staff 4,0K 23 mars  06:26 22.14.0
drwxr-sr-x  6 root staff 4,0K 24 avril 06:25 22.15.0
drwxr-sr-x  6 root staff 4,0K 15 mai   06:25 22.15.1

Ok I found that /etc/cron.daily/node_update doing the downloading auto at 6:25 every day.

Ok we miss N_PREFIX=/opt/node_n/ somewhere, anyway I disabled the node_update and I will check later.

List installed versions N_PREFIX=/opt/node_n/ ./bin/n ls.

This command no longer works:
grep: /etc/yunohost/apps/*/settings.yml: No such file or directory

Is there a new solution for this? I currently have 12.4 GiB of space occupied by node versions.

You either don’t have any apps installed (in which case you may delete everything related to node) or you should run the command with sudo

I’m getting the same result with sudo for some reason, but it works when I do sudo su -. ¯\(ツ)

Looks like the only version I need is 18:
/etc/yunohost/apps/umami/settings.yml:15:nodejs_version: '18'

I’m suspicious. Can that be right?

Update: Well, I’ve deleted everything < 18.20.8. Will report back if server borked.