How do I fix a script timeout error in protractor?

I got a script timeout error in Selenium. How to fix?

The best solution would be to get rid of $timeout and replace it with $interval.

Read here for more: javascript - Protractor - ScriptTimeoutError: asynchronous script timeout: result was not received in 20 seconds - Stack Overflow