skip to Main Content

I’m trying to update my AWS Amplify app and I get this error, I have no idea what’s wrong, everything works just fine locally. I’ve been trying to scan this log to see if I can understand anything from it but I cannot find what’s wrong. It successfully builds the backend and fails when after the front-end prebuild. I tried redeploying previous successful deployments, but they all fail as well, which confused me even more. Here are the Logs:
`

2022-11-17T22:49:16.082Z [INFO]: ## Starting Frontend Build
                                 # Starting phase: preBuild
2022-11-17T22:49:16.082Z [INFO]: # Executing command: npm ci
2022-11-17T22:49:20.209Z [WARNING]: npm
2022-11-17T22:49:20.211Z [WARNING]: WARN ERESOLVE overriding peer dependency
                                    npm WARN While resolving: @material-ui/[email protected]
                                    npm WARN Found: [email protected]
                                    npm WARN node_modules/react
                                    npm WARN   react@"^17.0.2" from the root project
                                    npm WARN   57 more (@coreui/icons-react, @coreui/react, ...)
                                    npm WARN
                                    npm WARN Could not resolve dependency:
                                    npm WARN peer react@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN node_modules/@material-ui/core
                                    npm WARN   peer @material-ui/core@"^3.2.0" from [email protected]
                                    npm WARN   node_modules/material-ui-pickers
                                    npm WARN   1 more (mdbreact)
                                    npm WARN
                                    npm WARN Conflicting peer dependency: [email protected]
                                    npm WARN node_modules/react
                                    npm WARN   peer react@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN   node_modules/@material-ui/core
                                    npm WARN     peer @material-ui/core@"^3.2.0" from [email protected]
                                    npm WARN     node_modules/material-ui-pickers
                                    npm WARN     1 more (mdbreact)
2022-11-17T22:49:20.218Z [WARNING]: npm WARN
2022-11-17T22:49:20.218Z [WARNING]: ERESOLVE overriding peer dependency
                                    npm WARN While resolving: @material-ui/[email protected]
                                    npm WARN Found: [email protected]
                                    npm WARN node_modules/react-dom
                                    npm WARN   react-dom@"^17.0.2" from the root project
                                    npm WARN   21 more (@coreui/react, @hookform/error-message, ...)
                                    npm WARN
                                    npm WARN Could not resolve dependency:
                                    npm WARN peer react-dom@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN node_modules/@material-ui/core
                                    npm WARN   peer @material-ui/core@"^3.2.0" from [email protected]
                                    npm WARN   node_modules/material-ui-pickers
                                    npm WARN   1 more (mdbreact)
                                    npm WARN
                                    npm WARN Conflicting peer dependency: [email protected]
                                    npm WARN node_modules/react-dom
                                    npm WARN   peer react-dom@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN   node_modules/@material-ui/core
                                    npm WARN     peer @material-ui/core@"^3.2.0" from [email protected]
                                    npm WARN     node_modules/material-ui-pickers
                                    npm WARN     1 more (mdbreact)
2022-11-17T22:49:20.224Z [WARNING]: npm WARN ERESOLVE overriding peer dependency
2022-11-17T22:49:20.225Z [WARNING]: npm WARN While resolving: @material-ui/[email protected]
                                    npm WARN Found: [email protected]
                                    npm WARN node_modules/react
                                    npm WARN   react@"^17.0.2" from the root project
                                    npm WARN   57 more (@coreui/icons-react, @coreui/react, ...)
                                    npm WARN
                                    npm WARN Could not resolve dependency:
                                    npm WARN peer react@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN node_modules/@material-ui/system
                                    npm WARN   @material-ui/system@"^3.0.0-alpha.0" from @material-ui/[email protected]
                                    npm WARN   node_modules/@material-ui/core
                                    npm WARN
                                    npm WARN Conflicting peer dependency: [email protected]
                                    npm WARN node_modules/react
                                    npm WARN   peer react@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN   node_modules/@material-ui/system
2022-11-17T22:49:20.225Z [WARNING]: npm WARN     @material-ui/system@"^3.0.0-alpha.0" from @material-ui/[email protected]
                                    npm WARN     node_modules/@material-ui/core
2022-11-17T22:49:20.229Z [WARNING]: npm WARN ERESOLVE overriding peer dependency
                                    npm WARN While resolving: @material-ui/[email protected]
                                    npm WARN Found: [email protected]
2022-11-17T22:49:20.229Z [WARNING]: npm WARN node_modules/react-dom
                                    npm WARN   react-dom@"^17.0.2" from the root project
                                    npm WARN   21 more (@coreui/react, @hookform/error-message, ...)
                                    npm WARN
                                    npm WARN Could not resolve dependency:
                                    npm WARN peer react-dom@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN node_modules/@material-ui/system
                                    npm WARN   @material-ui/system@"^3.0.0-alpha.0" from @material-ui/[email protected]
                                    npm WARN   node_modules/@material-ui/core
                                    npm WARN
                                    npm WARN Conflicting peer dependency: [email protected]
                                    npm WARN node_modules/react-dom
                                    npm WARN   peer react-dom@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN   node_modules/@material-ui/system
                                    npm WARN     @material-ui/system@"^3.0.0-alpha.0" from @material-ui/[email protected]
                                    npm
2022-11-17T22:49:20.229Z [WARNING]: WARN     node_modules/@material-ui/core
2022-11-17T22:49:20.235Z [WARNING]: npm WARN
2022-11-17T22:49:20.235Z [WARNING]: ERESOLVE overriding peer dependency
                                    npm WARN While resolving: @material-ui/[email protected]
                                    npm WARN Found: [email protected]
                                    npm WARN node_modules/react
                                    npm WARN   react@"^17.0.2" from the root project
                                    npm WARN   57 more (@coreui/icons-react, @coreui/react, ...)
                                    npm WARN
                                    npm WARN Could not resolve dependency:
                                    npm WARN peer react@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN node_modules/@material-ui/utils
                                    npm WARN   @material-ui/utils@"^3.0.0-alpha.2" from @material-ui/[email protected]
                                    npm WARN   node_modules/@material-ui/core
                                    npm
2022-11-17T22:49:20.235Z [WARNING]: WARN
                                    npm WARN Conflicting peer dependency: [email protected]
                                    npm WARN node_modules/react
                                    npm WARN   peer react@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN   node_modules/@material-ui/utils
                                    npm WARN     @material-ui/utils@"^3.0.0-alpha.2" from @material-ui/[email protected]
                                    npm WARN     node_modules/@material-ui/core
2022-11-17T22:49:20.240Z [WARNING]: npm WARN ERESOLVE
2022-11-17T22:49:20.240Z [WARNING]: overriding peer dependency
                                    npm WARN While resolving: @material-ui/[email protected]
                                    npm WARN Found: [email protected]
                                    npm WARN node_modules/react-dom
                                    npm WARN   react-dom@"^17.0.2" from the root project
                                    npm WARN   21 more (@coreui/react, @hookform/error-message, ...)
                                    npm WARN
                                    npm WARN Could not resolve dependency:
                                    npm WARN peer react-dom@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN node_modules/@material-ui/utils
                                    npm WARN   @material-ui/utils@"^3.0.0-alpha.2" from @material-ui/[email protected]
                                    npm WARN   node_modules/@material-ui/core
                                    npm WARN
                                    npm WARN Conflicting peer dependency: [email protected]
                                    npm WARN node_modules/react-dom
                                    npm WARN   peer react-dom@"^16.3.0" from @material-ui/[email protected]
                                    npm WARN   node_modules/@material-ui/utils
                                    npm WARN     @material-ui/utils@"^3.0.0-alpha.2" from @material-ui/[email protected]
                                    npm
2022-11-17T22:49:20.240Z [WARNING]: WARN     node_modules/@material-ui/core
2022-11-17T22:49:28.722Z [WARNING]: npm ERR! code ERESOLVE
2022-11-17T22:49:28.725Z [WARNING]: npm ERR!
2022-11-17T22:49:28.725Z [WARNING]: ERESOLVE could not resolve
                                    npm ERR!
                                    npm ERR! While resolving: [email protected]
                                    npm ERR! Found: [email protected]
                                    npm ERR! node_modules/react
                                    npm ERR!   react@"^17.0.2" from the root project
                                    npm ERR!   peer react@"^17.0.1" from @coreui/[email protected]
                                    npm ERR!   node_modules/@coreui/icons-react
                                    npm ERR!     @coreui/icons-react@"^1.1.0" from the root project
                                    npm ERR!   56 more (@coreui/react, @coreui/react-chartjs, @emotion/react, ...)
                                    npm ERR!
2022-11-17T22:49:28.725Z [WARNING]: 
                                    npm ERR! Could not resolve dependency:
                                    npm ERR! peer @react-native-community/async-storage@"^1.11.0" from [email protected]
                                    npm ERR! node_modules/aws-appsync
                                    npm ERR!   aws-appsync@"^4.0.3" from the root project
                                    npm ERR!   peer aws-appsync@"3.x.x || 4.x.x" from [email protected]
                                    npm ERR!   node_modules/aws-appsync-react
                                    npm ERR!     aws-appsync-react@"^4.0.3" from the root project
                                    npm ERR!
                                    npm ERR! Conflicting peer dependency: [email protected]
                                    npm ERR! node_modules/react
                                    npm ERR!   peer react@"^16.8" from @react-native-community/[email protected]
                                    npm ERR!   node_modules/@react-native-community/async-storage
                                    npm ERR!     peer @react-native-community/async-storage@"^1.11.0" from [email protected]
                                    npm ERR!     node_modules/aws-appsync
                                    npm ERR!       aws-appsync@"^4.0.3" from the root project
                                    npm ERR!       1 more (aws-appsync-react)
                                    npm ERR!
                                    npm ERR! Fix the upstream dependency conflict, or retry
                                    npm ERR! this command with --force, or --legacy-peer-deps
                                    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
                                    npm ERR!
                                    npm ERR! See /root/.npm/eresolve-report.txt for a full report.
2022-11-17T22:49:28.726Z [WARNING]: npm
2022-11-17T22:49:28.726Z [WARNING]: ERR! A complete log of this run can be found in:
                                    npm ERR!     /root/.npm/_logs/2022-11-17T22_49_16_301Z-debug-0.log
2022-11-17T22:49:28.737Z [ERROR]: !!! Build failed
2022-11-17T22:49:28.737Z [ERROR]: !!! Non-Zero Exit Code detected
2022-11-17T22:49:28.737Z [INFO]: # Starting environment caching...
2022-11-17T22:49:28.737Z [INFO]: # Uploading environment cache artifact...
2022-11-17T22:49:28.807Z [INFO]: # Uploaded environment cache artifact
2022-11-17T22:49:28.807Z [INFO]: # Environment caching completed
Terminating logging...

`

I tried redeploying previous successful builds, but that did help. I also tried changing the amplify.yaml file and adding --legacy-peer-deps to the end of the npm ci command and that also didn’t solve the problem. I tried manually updating the libraries mentioned in the logs, that did’t help either. I would really appreciate any suggestions in how to fix this. Thanks

I was trying to add a new feature to my web app, and what I was expecting was a successful build.

2

Answers


  1. In order to run npm ci successfully with the --legacy-peer-deps flag, you should add a .npmrc file to your repository with the legacy peer dependencies enabled as below;

    # ignore peerDependencies
    legacy-peer-deps=true
    

    It is important to add that your package-lock.json is equally required for the above to work as expected.

    Login or Signup to reply.
  2. Replace npm ci with npm install react@latest –legacy-peer-deps in amplify.yaml file. save and deploy, this worked for me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search