Version: MacOS 12.3.1 Monterey
Error message:
crun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
It is generally caused by system update. Enter the following command in the terminal and agree to install after a dialog box pops up.
xcode-select --install
After installation, reopen the terminal and input the command to operate normally.