When upgrading Amplify packages, it is important to make sure that there are no duplicate versions of Amplify packages in the `node_modules` folder tree as a result of the upgrade. Having multiple versions of packages can yield unexpected behavior as modules imported in your code might point to versions not configured by Amplify when calling `Amplify.configure`. A likely scenario that could point to duplicate versions of packages is getting console messages like: - `Amplify has not been configured correctly` - `Please make sure the Auth module is configured with a valid Cognito User Pool ID` - `User pool is not configured` - `No Auth module registered in Amplify` To prevent this situation, you can [Check for duplicate versions](#check-for-duplicate-versions), and if duplicate versions exists, then [Upgrade Amplify packages](#upgrade-amplify-packages). ## Check for duplicate versions The following commands will show you Amplify packages that appear multiple times in your `node_modules` folder. If the output is empty, it means that you don't have duplicate versions of Amplify packages. ```sh # Using YARN yarn list --pattern amplify | \ grep -o -e '@\?aws-amplify[^ ]*' | \ sort | uniq | \ sed -E 's/^(@?[^@]+).*$/\1/g' | \ uniq -d | sort ``` ```sh # Using NPM npm ls -all 2>/dev/null | \ grep -o -e '@\?aws-amplify[^ ]*' | \ sort | uniq | \ sed -E 's/^(@?[^@]+).*$/\1/g' | \ uniq -d | sort ``` ```powershell # Using YARN yarn list --pattern amplify | Select-String -Pattern '(@?aws\-amplify[^@]*).*(?$null | Select-String -Pattern '(@?aws\-amplify[^@]*).*(? --- ## Upgrade Amplify packages If you want to update all Amplify packages to the `latest` versions from npm, run the following command, it will also make sure that only one version of every Amplify package is installed. ```sh # Using YARN yarn upgrade --latest --pattern aws-amplify ``` ```sh # Using NPM npx npm-check-updates -i '/@?aws-amplify/' && npm update ``` ```powershell # Using YARN yarn upgrade --latest --pattern aws-amplify ``` ```powershell # Using NPM npx npm-check-updates -i '/@?aws-amplify/' && npm update ```