Silverstripe Version upgrade 4.9 to 5.1

How to fix this issue? :

Problem 1
- silverstripe/framework[5.0.0-alpha1, …, 5.x-dev] require silverstripe/vendor-plugin ^2 → found silverstripe/vendor-plugin[2.0.0-alpha1, …, 2.x-dev] but it conflicts with your root composer.json require (^1.0).

- silverstripe/login-forms[5.2.0-beta1, ..., 5.2.x-dev] require silverstripe/framework ^5 -> satisfiable by silverstripe/framework[5.0.0-alpha1, ..., 5.x-dev].

- Root composer.json requires silverstripe/login-forms ~5.2.0 -> satisfiable by silverstripe/login-forms[5.2.0-beta1, ..., 5.2.x-dev].

Looks like there is a conflict in package versions… composer is giving you a hint in the error:

silverstripe/vendor-plugin[2.0.0-alpha1, …, 2.x-dev] but it conflicts with your root composer.json require (^1.0).

So in your composer.json file, you have the vendor-plugin package with a constraint of ^1.0, but the framework package needs version 2. You should be able to either just remove the vendor-plugin line and let composer manage it, or set the constraint to ^2.0