1 company for 5 years vs 5 companies for 1 year each?

Be in control of your own destiny. You miss 100% of the chances you don’t take.

A lot of people will let their careers stagnate at the same company, but that doesn't necessarily mean you can't progress at the same company.

People say "I worked at the same place in the same job for 5 years and never got a promotion or raise!" but when pressed, they say they never asked about getting a promotion or a raise - they just expected it to happen.

Be in control of your own career trajectory. Ask your boss what it takes to get to the next level. Ask about the promotion process, the review process, how raises and bonuses are handed out, etc. Then play the game - treat the process like the rule set for a game and follow those rules to get to the next level. Be a textbook case for promotion.

And if you get to the point where you think you should be promoted and you aren't, you are likely at a dead-end at that company and you should start looking somewhere else.

Don't forget that you can also change job ladders and teams within a company, if you think there's a job or team where you'd have a better chance at growth.

Also, getting promoted at a company instead of between jobs looks great on your resume. It shows that not only are you smart enough to get hired there in the first place, but you work hard enough to get promoted to a more senior position.

You can grow at one company, but if you can't then you should leave.