13

Trying to reduce any changing variables and using a fresh pull of my code. They are no node-module packages or package-lock.json. I run npm install I get this error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/react-native-screens
npm ERR!   react-native-screens@"~2.15.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-screens@"^1.0.0 || ^1.0.0-alpha" from [email protected]
npm ERR! node_modules/react-navigation-drawer
npm ERR!   react-navigation-drawer@"^1.4.0" from the root project
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 /Users/myname/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/myname/.npm/_logs/2021-05-22T01_16_02_351Z-debug.log

If I do an install via --force or npm install --legacy-peer-deps I get a bunch of files mark as outdated and when I run npm update I get the same error. I have tried clearning the cache of my npm as well with no luck npm cache clean. I don't know why this is happening as there is no node-module folder or anything installed for it to give error under my node_modules/react-native-screens...they are no node_modules folder yet. What is causing this and how can I fix it?

Edit: I ran npm update -g , then npm audit fix and then I got an error:

code ERESOLVE
ERESOLVE unable to resolve dependency tree

While resolving: Sculp latest app@undefined
Found: [email protected]
node_modules/react-native-screens
react-native-screens@“~2.15.0” from the root project

so I ran expo install react-native-screens and saw that it couldn't find expo...checked my folder and my node_module folder is missing. Like if it never was there or gotten installed.

edit: I have tried all the methods listed below and it gives random errors that I can not fix it undefined is not an object (evaluating ‘_core.ThemeColors.light’) and I have googled this and one of the main solutions is delete npm and package-lock.json and reinstall but that brings me back to where I started.

1

5 Answers 5

23

It works for me:

npm install --save --legacy-peer-deps
Sign up to request clarification or add additional context in comments.

2 Comments

everything installs but then it throws one error after another and the last error that I can't fix is undefined is not an object (evaluating ‘_core.ThemeColors.light’)
worked like a charm.
3

Try this:

npm config set legacy-peer-deps true

Note: this will set this flag permanently

For one time:

npm install --save --legacy-peer-deps

Comments

0

Try to copy your src folder and package.json file and initialize another react-native (new) and replace the source the src folder and package.json file and reenter npm install.

1 Comment

can you show your folder structure before and after reinstalling all the dependency.
0

You can use --force in the command line, but you will problably have to deal with a broken react-native dependency later. Anyway, there are other ways of dealing with this broken dependency.

Comments

-3

Try it in the following:

npm add react-native
expo install (your needed module)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.