Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated May 21, 2024

Upgrading Amplify packages

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, and if duplicate versions exists, then 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.

# Using YARN
yarn list --pattern amplify | \
grep -o -e '@\?aws-amplify[^ ]*' | \
sort | uniq | \
sed -E 's/^(@?[^@]+).*$/\1/g' | \
uniq -d | sort
# Using npm
npm ls -all 2>/dev/null | \
grep -o -e '@\?aws-amplify[^ ]*' | \
sort | uniq | \
sed -E 's/^(@?[^@]+).*$/\1/g' | \
uniq -d | sort
# Using YARN
yarn list --pattern amplify |
Select-String -Pattern '(@?aws\-amplify[^@]*).*(?<!deduped)$' |
%{$_.Matches.Groups[1].value} | Group-Object |
Where-Object { $_.Count -gt 1 } | Select-Object -ExpandProperty Name |
Sort-Object
# Using npm
npm ls -all 2>$null |
Select-String -Pattern '(@?aws\-amplify[^@]*).*(?<!deduped)$' |
%{$_.Matches.Groups[1].value} | Group-Object |
Where-Object { $_.Count -gt 1 } | Select-Object -ExpandProperty Name |
Sort-Object

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.

# Using YARN
yarn upgrade --latest --pattern aws-amplify
# Using npm
npx npm-check-updates -i '/@?aws-amplify/' && npm update
# Using YARN
yarn upgrade --latest --pattern aws-amplify
# Using npm
npx npm-check-updates -i '/@?aws-amplify/' && npm update