If you follow the Capacitor environment-setup docs you shouldn’t need sudo.
For not needing sudo for node/npm it recommends using volta or homebrew for managing nodejs versions (I personally prefer nvm and I’ve seen homebrew installed nodejs to have some problems)
For not needing sudo for installing cocoapods it recommends using homebrew, which also prevents some problems cocoapods have on Apple Silicon computers.