I was wondering why my 40 GB VPS only has 12 GB space left, then I run sudo du -h / | sort -h and was surprised to see that more than 8 GB is used by only node in the directories
Can be something done about it? Is all this space necessary? There seem to be node versions from 10 to 15 installed in both the /opt/node_n and usr/local/n
Indeed that sounds overkill … I’m wondering what in node/n exactly takes so much space … Are you able to dig in /usr/local/n/versions/node and /opt/node_n/n/versions/node to find out how much the subfolders weight ?
Yeah it’s a known issue that those doesn’t get cleanedup … but I’m surprised that it ends up weighting so much, and that there’s also stuff in /usr/local/n/versions/node which apparently is different from the content in /opt/node_n/n/versions/node (for example the size for 14.17.3 is different on both side)
Hmokay I’m gonna try to implement some autocleanup mecanism that makes more sense than the current stuff … but not gonna be available until yunohost 4.3.x
Note that sometimes you may see for example version “14” or “12”, and this should in fact correspond to something like /opt/node_n/n/versions/node/14 which should be a symlink to the latests 14.x.y version … But other versions (not pointed by a symlink) should be removable
FYI, in the upgrade script, in case the app requires a newer NodeJS version the older one is not removed. I ended up using this bit of code:
# $nodejs_version defined in scripts/_common.sh
if [ $(ynh_app_setting_get --app=$app --key=nodejs_version) != $nodejs_version ]; then
ynh_remove_nodejs
ynh_install_nodejs --nodejs_version=$nodejs_version
fi
But maybe we could improve the helpers themselves.
Thanks fot the tip, it was usefull as my /usr/local/n/versions/node has all upgrades since 12 and up to 14 packages and uses up to 2.3Gb, while /opt/node_n is 930Mb.
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
I finally found that is nodejs eating all my disk space, and after found this useful topic.
Thanks fort that tip, 5GB could be removed, and keep version 16. /etc/yunohost/apps/peertube/settings.yml:18:nodejs_version: '16'
Just a question…
To remove old version, can i just delete with rm -R those folders, or a special command must be used ?
Hello,
I am running into the same disk space issue : node takes 5.7 GB (in /usr/local/n) + 3.1 GB (in /opt/node_n) = 8.8 Gb (!!) while it seems none of my current yunohost app uses it :
Can I safely remove node (my main app that I absolutely do not want to break is NextCloud) ? Is there a way to check whether something else (a Nextcloud app ?) uses Node ?
How can I remove all the (over 50!!! from 10.21.0 to 16.20.1) installed versions ? I guess I could use an apt remove command to remove it all… If I want to keep the latest version of Node to be safer, can I simply remove the older versions using a simple rm -R folders like suggested by @makotoworkshop ?
This seems close to the level where a maintenance script could do it. Perhaps to be run manually, or as part of infrequent manual maintenance. (I would refrain from having it purge on installs in case user manually install versions for services not managed by ynh, or without the proper metadata).
Not sure to understand why we have both some nodejs versions in /opt/node_n/n/versions and /usr/local/n/versions.
Is it a wrong config somewhere ?
All the apps I have running use /opt/node_n/n/versions/node/20/bin in PATH. And it seems that a cron script update/adding versions auto magically at 06:25 in /usr/local/n/versions/node/.