Amplify Console provides a feature called Live package updates. The default package build used by Amplify console comes with preinstalled dependencies. If you configure Live Package Updates It will override the version of the pre-installed dependencies including Amplify CLI and specify either a specific version, or always ensure the latest version is installed.
Note: This may increase the time of build as It will update the dependencies, but the advantage is that you can ensure the same version of a dependency is used to build your app.
Live package updates can be configured in App -> App Settings > Build Settings
Please feel free to have a look at other articles here