Module not found: Can't resolve '#aws-amplify/core' - reactjs

Trying to create a React App using amplify authentication, stuck with this error
Module not found: Can't resolve '#aws-amplify/core' in '..\node_modules#aws-amplify\api\lib-esm'
I have been referring to these two links:
https://dev.to/dabit3/the-complete-guide-to-user-authentication-with-the-amplify-framework-2inh
https://docs.amplify.aws/lib/auth/getting-started/q/platform/js
What have I already tried:
deleting node_modules and reinstalling the project
trying to explicitly install #aws-amplify/core using npm (This throws a separate error)
Any help is appreciated :)

I ran into this issue working with AWS Datastore which also depends on #amplify/core. Here's how I resolved it:
npm i #aws-amplify/core --save --legacy-peer-deps
React component:
import Amplify from "#aws-amplify/core
The legacy peer deps flag was required in my case as the install React version was greater than the version required for amplify/core. You may also need to amplify init or amplify pull first if you've not already done so.

The perfect solution is as mentioned above. I found this after a lot of research. Need to install #aws-amplify/core. But along with that in my react app, I have to install some more packages for cognito to work properly.
npm i #aws-amplify/core --save --legacy-peer-deps
npm i #aws-amplify/storage --save --legacy-peer-deps
npm i #aws-amplify/interactions --save --legacy-peer-deps
npm i #aws-amplify/auth --save --legacy-peer-deps
npm i #aws-amplify/api --save --legacy-peer-deps
npm i #aws-amplify/analytics --save --legacy-peer-deps
npm i #aws-amplify/xr --save --legacy-peer-deps

Do npm install aws-amplify#latest sometimes this problem happens cuz the version i think.
After stop the project and run it again.

I was facing the same errors after upgrading #aws-amplify/ui-react from 1.x to 4.x
I have tried the below steps and errors got resolved after that.
Removed node_modules and package-lock.json files.
npm install

Related

Unable to resolve dependency tree error with legacy peer deps

I made an app in react with BuilderX and this happens when I type npm install in terminal:
And these are the dependencies
I would appreciate your help :)
I tried using npm install --save --legacy-peer-deps but it doesn't work

how to implement redux in angular9?

I am trying to use redux in my application but I am getting error as:
The target entry-point "#angular-redux/store" has missing dependencies:
- redux
- redux-devtools-extension
Any suggestions.
You can install implement redux in angular by three dependencies.
npm install redux --save
npm install #angular/core --save
npm install redux-devtools --save
As it said,
please install it.
npm install redux-devtools-extension .
Eventhough its a dev dependency, this we've to install manually
Though they should have come in as dependencies with the initial package install, try manually installing redux and redux-devtools:
npm install redux
npm install redux-devtools

difference between npm install react-router-dom and npm install --save react-router-dom command

difference between npm install react-router-dom and npm install --save react-router-dom command
I tried both commands and got same result so can't understand what the actual working difference between these commands
Starting from version 5 npm will save the package to your dependencies by default. For previous versions you needed --save flag to do that.
More info: https://github.com/npm/npm/issues/5108
With the advent of npm v5 or greater, by default, it will be saved without the --save flag.
Prior to npm 5, the --save command will also save the package name under the package.json file under the dependencies object.
This will ensure than if this project was to be pulled/cloned on a different computer, you can type npm install to install all the dependencies listed under the package.json.
Whereas without --save, the dependency will not be put into package.json dependencies list. And when you type npm install in a new environment, you will be missing that package.

React requiring a peer React-Dom

I am quite new in React and front end dev.
I am following a tutorial from udemy that require to install react-simple-sidenav module in order to get a NavBar.
However when I try to install it no way to make it work. I get the following error message after running the command npm install react-simple-sidenav
And the navBar doest not work event if it is copy past from the tuto
npm WARN react-simple-sidenav#0.1.6 requires a peer of react-dom#^15.0.0 but none is installed. You must install peer depe
ndencies yourself.
Could you help me ?
You need to install react-dom from NPM library, in your command line type the following:
npm i -s react-dom

react-qr-reader installation issue with REACT

I'm trying to install react-qr-reader from https://github.com/JodusNodus/react-qr-reader. I installed REACT and REACT dom just fine but after I added the react-qr-reader package I get this:
root#server [~]# npm install --save react-qr-reader
npm WARN react-qr-reader#2.0.1 requires a peer of react#^15.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN react-qr-reader#2.0.1 requires a peer of react-dom#^15.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN root#1.0.0 No description
npm WARN root#1.0.0 No repository field.
How can I identity the missing peer?
When I try and load the js script I get an "Uncaught SyntaxError: Unexpected identifier" at that line: "import React, { Component } from 'react'". So I'm assuming PEAR is not even properly installed.
First you need to install react and react-dome
npm i react react-dom
Then try install react-qr-reader with sudo command
sudo npm i react-qr-reader --save
npm i react-qr-reader --force
use This its definitely Work For You

Resources