The answer for this isn't any number of years. I believe you should only tie the knot if you are so secure in your relationship that you can get through fights, genuinely trust each other, and have no doubt that they truly love each other. If you two have to get away from each other every time they fight, if a fight results in a break up, if one suspects the other of cheating, regardless if the other person did or not, or if there is any doubt they should be together, they aren't ready for marriage. Building a secure relationship may take a year, or it may take 10 years.
Are you ready to marry in my opinion?
Are you both over 18?
Are you willing to compromise (Compromise doesn't mean you get everything, and your partner gets nothing.)
Are you without a doubt sure you want to spend the rest of our life with your partner?
Are you able to pull through fights? (Without taking a break for some time)
Do you trust your partner?
Are you able to accept the negative things about your partner? (They're not perfect.)
If you can answer yes to every question, you have a secure relationship. If you say no to any of these questions, it doesn't necessarily mean you're bad. In fact, maybe you have a good reason for not trusting your partner, for example. Nevertheless, your relationship isn't secure enough for marriage. When you get married, you aren't just marrying their positive qualities. You are also marrying the qualities they have that you hate. Marriage is a rose. Roses are great to have, but you shouldn't run into a bed of roses because they have thorns. Admire the roses, but watch out for the thorns.