Here I put the final solution. I tried many methods on my mac M1, the best method is re-install homebrew.
Step1:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
Step2:
Install homebrew
cd /opt
mkdir homebrew # if not exist, just create one.
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
Then, the problem solved.