Magento 2 Error on pages Class Magento\Framework\Filter\VariableResolver\StrategyResolver does not exist.

I am facing an error while looking at any pages on the front end by getting the latest code from the branch.
I have just checked out with the branch that has upgraded Magento to the latest version 2.4.6-p1.

Every page in the front end throws an error like the given,

Class Magento\Framework\Filter\VariableResolver\StrategyResolver does not exist.

How to fix this error?

  • rm -rf vendor/ from the root of your Magento project,
  • Run the composer command, composer install
  • Clear the cache

Check again the homepage and the error will be resolved.