When looking at your code, nothing major stood out. I would expect it to work just fine and in order for me to further dig into this, could you share with me the HubSpot portal that you're looking to use the get all companies endpoint?
I tried using the same request url on your portal and I was able to received a 200 response. Could you try using Postman to see if the following request url works?
One note: This is a public forum, so you should refrain from posting any sensitive data, particularly authorization keys (e.g. API keys, OAuth tokens, etc.). I've removed your hapikey from the image, but I would strongly recommend deactivating it and generating a new one since it was visible on the forums for a while.
By taking forever do you mean that after running the code, the endpoint isn't returning back a response for a long period of time? Even with both the parameter limit=2 and count=5? In this case, are you still seeing the error - SyntaxError: Unexpected token < in JSON at position 0?