On macOS, in VScode, Latex reports an error during build and displays as follows:
Recipe ternimated with fatal error: spwan pdflatex/latexmk ENOENT
the local tex is not written into the PATH, or the texlive path in the PATH is wrong (mine was updating the texlive and the installation directory name changed).
Find the installation path of texlive, such as my path is
export PATH=dir:$PATH in zshrc or bashrc.