简体   繁体   中英

AWS amplify Can't resolve '@aws-amplify/core'

As the title suggests, when I run npm start in my project folder the I get the following error:

Module not found: Can't resolve '@aws-amplify/core' in '/Users/xxxxxx/Desktop/react-amplified/node_modules/@aws-amplify/api/lib-esm'

The project is literally the template code created by npx create-react-app react-amplified cd react-amplified

I tried installing @aws-amplify/core directly but that didn't work.

Take a look at https://docs.amplify.aws/start/getting-started/installation/q/integration/react#option-1-watch-the-video-guide

When scaffolding a new react app, there are a few steps beyond npx create-react-app that need to be run to Amplify your project.

  1. amplify configure to setup your amplify cli
  2. amplify init to initialize your backend resources in AWS.

Did you try amplify init ? Look at the docs and install all the dependencies. https://docs.amplify.aws/start/q/integration/js?sc_icampaign=start&sc_ichannel=docs-home

This is an issue with using amplify 4 with npm 7 hoisting and has a PR here https://github.com/aws-amplify/amplify-js/pull/8368

It looks like there is an issue with Amplify 4 and NPM 7. Using yarn fixed this issue for me!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM