gpt4 book ai didi

reactjs - 找不到模块 : Can't resolve '@aws-amplify/core'

转载 作者:行者123 更新时间:2023-12-03 08:21:17 25 4
gpt4 key购买 nike

尝试使用 amplify 身份验证创建 React 应用程序,但遇到此错误

找不到模块:无法解析“..\node_modules@aws-amplify\api\lib-esm”中的“@aws-amplify/core”

我一直在引用这两个链接:

我已经尝试过什么:

  • 删除node_modules并重新安装项目
  • 尝试使用 npm 显式安装 @aws-amplify/core(这会引发单独的错误)

感谢任何帮助:)

最佳答案

我在使用 AWS Datastore 时遇到了这个问题,它也依赖于 @amplify/core。我是这样解决的:

npm i @aws-amplify/core --save --legacy-peer-deps

react 组件:

import Amplify from "@aws-amplify/core

在我的情况下,需要旧版对等 deps 标志,因为安装 React 版本高于 amplify/core 所需的版本。如果您还没有这样做,您可能还需要首先amplify initamplify pull

关于reactjs - 找不到模块 : Can't resolve '@aws-amplify/core' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67769245/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com