Use Docker. Containers used for official build can be found here.:
https://github.com/godotengine/build-containers
I edited the answer to update my script with registry name(this is new security requirement on some distros). If your module still does not build check your Sconstruruct file(one which you wrote for your module) for typos.
My personal interactive mega container for Win/JS/Android:
FROM docker.io/fedora:latest
RUN cd /root && \
echo 'fastestmirror=true' >> /etc/dnf/dnf.conf && \
dnf -y upgrade && \
dnf -y install scons mingw64-gcc-c++ mingw64-winpthreads-static \
mingw32-gcc-c++ mingw32-winpthreads-static make binutils \
yasm which xz lbzip2 java-1.8.0-openjdk-devel git unzip && \
dnf -y clean all && \
curl -O 'https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash' && \
echo '. ~/git-completion.bash' >> ./.bashrc && \
curl -O 'https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh' && \
echo '. ~/git-prompt.sh' >> ./.bashrc && \
echo 'export GIT_PS1_SHOWDIRTYSTATE=1' >> ./.bashrc && \
echo export PS1=\'\\w\$'(__git_ps1 " (%s)")'\\$ \' >> ./.bashrc && \
curl -LO 'https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip' && \
mkdir ./android && \
unzip ./commandlinetools-linux-6609375_latest.zip -d ./android/cmdline-tools && \
rm ./commandlinetools-linux-6609375_latest.zip && \
echo 'export ANDROID_HOME=~/android/' >> ./.profile && \
echo 'export ANDROID_NDK_ROOT=~/android/ndk-bundle/' >> ./.profile && \
echo 'export ANDROID_NDK_HOME=~/android/ndk-bundle/' >> ./.profile && \
mkdir ./.android && \
touch ./.android/repositories.cfg && \
yes | ./android/cmdline-tools/tools/bin/sdkmanager --licenses && \
./android/cmdline-tools/tools/bin/sdkmanager --install ndk-bundle && \
git clone https://github.com/emscripten-core/emsdk.git && \
./emsdk/emsdk install latest && \
./emsdk/emsdk activate latest && \
echo '. ~/emsdk/emsdk_env.sh' >> ./.bashrc && \
git clone https://github.com/godotengine/godot.git
CMD ["/bin/bash"]