【问题标题】:AWS Amplify deployments failingAWS Amplify deployments failing
【发布时间】:2022-12-26 17:46:17
【问题描述】:

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/core@3.9.3
                                    npm WARN Found: react@17.0.2
                                    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/core@3.9.3
                                    npm WARN node_modules/@material-ui/core
                                    npm WARN   peer @material-ui/core@"^3.2.0" from material-ui-pickers@2.2.4
                                    npm WARN   node_modules/material-ui-pickers
                                    npm WARN   1 more (mdbreact)
                                    npm WARN
                                    npm WARN Conflicting peer dependency: react@16.14.0
                                    npm WARN node_modules/react
                                    npm WARN   peer react@"^16.3.0" from @material-ui/core@3.9.3
                                    npm WARN   node_modules/@material-ui/core
                                    npm WARN     peer @material-ui/core@"^3.2.0" from material-ui-pickers@2.2.4
                                    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/core@3.9.3
                                    npm WARN Found: react-dom@17.0.2
                                    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/core@3.9.3
                                    npm WARN node_modules/@material-ui/core
                                    npm WARN   peer @material-ui/core@"^3.2.0" from material-ui-pickers@2.2.4
                                    npm WARN   node_modules/material-ui-pickers
                                    npm WARN   1 more (mdbreact)
                                    npm WARN
                                    npm WARN Conflicting peer dependency: react-dom@16.14.0
                                    npm WARN node_modules/react-dom
                                    npm WARN   peer react-dom@"^16.3.0" from @material-ui/core@3.9.3
                                    npm WARN   node_modules/@material-ui/core
                                    npm WARN     peer @material-ui/core@"^3.2.0" from material-ui-pickers@2.2.4
                                    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/system@3.0.0-alpha.2
                                    npm WARN Found: react@17.0.2
                                    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/system@3.0.0-alpha.2
                                    npm WARN node_modules/@material-ui/system
                                    npm WARN   @material-ui/system@"^3.0.0-alpha.0" from @material-ui/core@3.9.3
                                    npm WARN   node_modules/@material-ui/core
                                    npm WARN
                                    npm WARN Conflicting peer dependency: react@16.14.0
                                    npm WARN node_modules/react
                                    npm WARN   peer react@"^16.3.0" from @material-ui/system@3.0.0-alpha.2
                                    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/core@3.9.3
                                    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/system@3.0.0-alpha.2
                                    npm WARN Found: react-dom@17.0.2
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/system@3.0.0-alpha.2
                                    npm WARN node_modules/@material-ui/system
                                    npm WARN   @material-ui/system@"^3.0.0-alpha.0" from @material-ui/core@3.9.3
                                    npm WARN   node_modules/@material-ui/core
                                    npm WARN
                                    npm WARN Conflicting peer dependency: react-dom@16.14.0
                                    npm WARN node_modules/react-dom
                                    npm WARN   peer react-dom@"^16.3.0" from @material-ui/system@3.0.0-alpha.2
                                    npm WARN   node_modules/@material-ui/system
                                    npm WARN     @material-ui/system@"^3.0.0-alpha.0" from @material-ui/core@3.9.3
                                    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/utils@3.0.0-alpha.3
                                    npm WARN Found: react@17.0.2
                                    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/utils@3.0.0-alpha.3
                                    npm WARN node_modules/@material-ui/utils
                                    npm WARN   @material-ui/utils@"^3.0.0-alpha.2" from @material-ui/core@3.9.3
                                    npm WARN   node_modules/@material-ui/core
                                    npm
2022-11-17T22:49:20.235Z [WARNING]: WARN
                                    npm WARN Conflicting peer dependency: react@16.14.0
                                    npm WARN node_modules/react
                                    npm WARN   peer react@"^16.3.0" from @material-ui/utils@3.0.0-alpha.3
                                    npm WARN   node_modules/@material-ui/utils
                                    npm WARN     @material-ui/utils@"^3.0.0-alpha.2" from @material-ui/core@3.9.3
                                    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/utils@3.0.0-alpha.3
                                    npm WARN Found: react-dom@17.0.2
                                    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/utils@3.0.0-alpha.3
                                    npm WARN node_modules/@material-ui/utils
                                    npm WARN   @material-ui/utils@"^3.0.0-alpha.2" from @material-ui/core@3.9.3
                                    npm WARN   node_modules/@material-ui/core
                                    npm WARN
                                    npm WARN Conflicting peer dependency: react-dom@16.14.0
                                    npm WARN node_modules/react-dom
                                    npm WARN   peer react-dom@"^16.3.0" from @material-ui/utils@3.0.0-alpha.3
                                    npm WARN   node_modules/@material-ui/utils
                                    npm WARN     @material-ui/utils@"^3.0.0-alpha.2" from @material-ui/core@3.9.3
                                    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: aws-appsync@4.0.5
                                    npm ERR! Found: react@17.0.2
                                    npm ERR! node_modules/react
                                    npm ERR!   react@"^17.0.2" from the root project
                                    npm ERR!   peer react@"^17.0.1" from @coreui/icons-react@1.1.0
                                    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 aws-appsync@4.0.5
                                    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 aws-appsync-react@4.0.5
                                    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: react@16.14.0
                                    npm ERR! node_modules/react
                                    npm ERR!   peer react@"^16.8" from @react-native-community/async-storage@1.12.1
                                    npm ERR!   node_modules/@react-native-community/async-storage
                                    npm ERR!     peer @react-native-community/async-storage@"^1.11.0" from aws-appsync@4.0.5
                                    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.

【问题讨论】:

  • I'm having the same problem, i believe this is happening because npm packages conflict, but have no idea how to fix it
  • I have exactly the same issue. Any updates, were you able to fix it?

标签: node.js amazon-web-services aws-amplify aws-appsync aws-amplify-cli


【解决方案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.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-10
    • 2019-03-04
    • 1970-01-01
    • 2020-09-20
    • 2021-07-31
    • 2019-08-30
    • 2018-10-27
    • 2021-02-17
    相关资源
    最近更新 更多