@aditya-appyhigh Hi. Your message got kind of buried in the forum. This is a frustrating bug where you need to make the directory "public" in the module path. NodeBB requires that file paths actually exist for things to compile even if nothing is at the path.
To fix go to your module directory from the nodebb root.
Mine is here:
/var/www/nodebb/node_modules/nodebb-plugin-s3-uploads-updated
mkdir /var/www/nodebb/node_modules/nodebb-plugin-s3-uploads-updated/public
Then retry ./nodebb build