ERESOLVE could not resolve on build - reactjs

I am trying to deploy a React Native project, however when using React Native 18.0.0 - I get the following errors:
Solutions Tried
removing node_modules and package.json.lock and downgrading react to 17.0.2 - I then get:
npm install --legacy-peer-deps
npm i web-vitals --save-dev
npm config set legacy-peer-deps
Nothing works.
Is successful deployment even possible?

Check your package.json probably you have the wrong version or react in dependencies. The right version for RN 0.69.6 is "react": "18.0.0"

Related

Why Is Mui No Longer Installing?

I am trying to use mui select in my React App. After using
npx create-react-app .
I then use
npm install #mui/material #emotion/react #emotion/styled
to install mui.
After following the steps to install Mui I am getting this error:
Could not resolve following dependency: peer react#"^17.0.0" from #mui/material#5.5.3
but it is apparently installed in the package.json:
"dependencies": {
..
"react": "^18.0.0",
..
}
If anyone could help me figure out what's going on here, I'd sure appreciate it.
MUI seems to be not ready for React Version 18.
The error message says, that Material UI Version 5.5.3 (which is the latest as of 2022-03-31) needs React with major version number 17 as peer dependency.
I hope someone has a better answer, but as of now it seems that we have to wait until the version number of React as peer dependency gets bumped to 18.0.0.
Current progress of the MUI project
Edit: following this Answer you should be able to get it working by using the --legacy-peer-deps flag
npx create-react-app test
cd test
npm install #mui/material #emotion/react #emotion/styled --legacy-peer-deps

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

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

npm ERR! code ENOSELF while installing react dependencies

when I try to install dependencies using 'npm install react react-dom prop-types --save-dev' to the react (in webstorm) it shows an error 'npm ERR! code ENOSELF'.
it did work correctly before so i tried 2 3 times creating new projects
npm install react react-dom prop-types --save-dev
npm install react react-dom prop-types --save-dev should install all the dependencies but it shows an error
For this error,
make sure that the project name and package name should not be the same.
or just rename the package name property in my package.json in the branch...
rename your project directory to something else....
then execute below command
npm audit fix
or
npm audit fix --force

Meteor-React tutorial: missing step to install Babel package

I'm following the official Todo App with React tutorial. If I follow the steps exactly, after step 2.5, I get an error:
=> Exited with code: 1
Unable to resolve some modules:
"#babel/runtime/helpers/interopRequireDefault" in
/.../todos/imports/ui/App.js (web.browser.legacy)
"#babel/runtime/helpers/inheritsLoose" in
/.../todos/imports/ui/App.js (web.browser.legacy)
If you notice problems related to these missing modules, consider running:
meteor npm install --save #babel/runtime
It seems that the current versions of Meteor and the React npm package do not automatically install Babel, so JSX code is not converted to JS.
It would make life easier for others who want to follow this tutorial if the commands ...
meteor npm install --save react react-dom
meteor npm install --save #babel/runtime
... were given together.

First React application setup: Webpack has been initialised using a configuration object that does not match the API schema

I am trying to setup my first react application. I installed all the npm packages required. But getting this error.
npm uninstall webpack --save-dev
npm install webpack#2.1.0-beta.22 --save-dev

Resources