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
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.
I just wanted to add that this is still an issue. Even if you’ve deleted the app(s) that used NodeJS in the first place.
I deleted HedgeDoc which I did not come around to actually use. And ran in to this issue of all of a sudden having hardly no space left on my drive.
Thanks to this life saver thread, I could quickly remedy the issue.
Simply deleting the n/versions/node/xx folders and all is well again.
However it would be awesome to have information about these kinds of dependencies in the UI and also, have some detailed disk usage information with warnings.
This is of course easier said than done. And another solution would be to have some better monitoring set up (which I will get around to someday) that could inform me of the situation earlier.
Anyway, just wanted to say thanks to all participants in the thread that made this an easy peasy troubleshooting.
All node packages are being converted to support the new nodejs resource which will help solve this issue (for the future, not for the previous installed versions)
Also upgrading or force-upgrading an app that uses nodejs may (I’m not 100% sure it’s been a long time since I implemented this) trigger a garbage collector that should get rid of unused node versions
The issue seems to be that there is a N_PREFIX=/opt/node_n missing in node_update.sh when launching n with sudo: sudo N_PREFIX=/opt/node_n $n_install_dir/bin/n $version will download and install n in /opt/node_n/n/versions instead of /usr/local/n/versions
That should solve the problem of duplicate node versions found in /usr/local/n/versions.
That said, I’m still a bit confused: is node_update.sh still needed in current yunohost versions?