Yunohost 12.2.24 / Peertube 6.2.1~ynh1 | Unable to move videos from storage to bucket (Blackbaze)

You should not run commands as root in the apps directories. If the following commands complain about file permissions (that may be due to your commands run as root), you will need to force-upgrade the app to fix: yunohost app upgrade peertube -F


Now, onto your issue.
Open a shell into the Peertube app first (that will, hopefully, properly load the Node environment):

yunohost app shell peertube

Then run your commands again.