Error when running 'npm install' and 'npm start' - react-native

I ran npm install in my project directory.
But I get this error while running npm install:
D:\Personal\██████████████████████████████████████████████████████████████\rn-starter-main>npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! react#"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.0" from #react-native-community/masked-view#0.1.10
npm ERR! node_modules/#react-native-community/masked-view
npm ERR! #react-native-community/masked-view#"0.1.10" 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 C:\Users\███████\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\███████\AppData\Local\npm-cache\_logs\2022-04-02T02_39_48_352Z-debug-0.log```
npm install --force installed the packages, but when I run npm start, I get the following error:
D:\Personal\████████████████████████████████████████████████████████\rn-starter-main>npm start
> start
> expo start
┌─────────────────────────────────────────────────────────────────────────┐
│ │
│ There is a new version of expo-cli available (5.3.0). │
│ You are currently using expo-cli 5.1.1 │
│ Install expo-cli globally using the package manager of your choice; │
│ for example: `npm install -g expo-cli` to get the latest version │
│ │
└─────────────────────────────────────────────────────────────────────────┘
Starting project at D:\Personal\███████████████████████████████████\rn-starter-main
Unable to find expo in this project - have you run yarn / npm install yet?
For the conflicting peer dependency error, I tried:
npm install --legacy-peer-deps and
npm install --force
But none of them seems to have worked. This error is still persisting.
For the expo not found error, I tried commands like:
npm cache clean,
expo install,
expo update,
npm add expo
expo rebuild etc.
I thought this error might be due to older expo versions like 36 and 37 that I've worked with, so, I uninstalled all of Node and NPM and downloaded them again from https://nodejs.org/en/ , but I still get the same "conflicting peer dependency" and "Unable to find expo" errors. Could you please help me with this? Thank you.

Running the command npm install -g expo-cli fixes both the errors. These errors are just due to npm not being installed globally.

Related

Failed to install react-native-web#~0.18.7, react-dom with error: npm exited with non-zero code: 1 npm exited with non-zero code: 1

I am trying to start a expo project on web but it throws this error, Can anyone help me please?
Press a │ open Android
› Press w │ open web
› Press r │ reload app
› Press m │ toggle menu
› Press ? │ show all commands
Logs for your project will appear below. Press Ctrl+C to exit.
Started Metro Bundler
√ It looks like you're trying to use web support but don't have the required dependencies installed. Would you like to install
react-native-web, react-dom? ... yes
× Failed to install react-native-web#~0.18.7, react-dom with error: npm exited with non-zero code: 1
npm exited with non-zero code: 1
?
› Stopped server
C:\Users\Human\News-Application>expo start
This command is being executed with the global Expo CLI. Learn more: https://blog.expo.dev/the-new-expo-cli-f4250d8e3421
To use the local CLI instead (recommended in SDK 46 and higher), run:
› npx expo start
Starting project at C:\Users\Human\News-Application
"react-native-web" is added as a dependency in your project's package.json but it doesn't seem to be installed. Please run "yarn" or "npm install" to fix this issue.
C:\Users\Human\News-Application>npm install react-native-web
npm WARN config global --global, --local are deprecated. Use --location=global instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: news-application#1.0.0
npm ERR! Found: react#18.1.0
npm ERR! node_modules/react
npm ERR! react#"18.1.0" from the root project
npm ERR! peer react#"^17.0.2 || ^18.0.0" from react-native-web#0.18.12
npm ERR! node_modules/react-native-web
npm ERR! react-native-web#"~0.18.7" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^18.2.0" from react-dom#18.2.0
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#"^17.0.2 || ^18.0.0" from react-native-web#0.18.12
npm ERR! node_modules/react-native-web
npm ERR! react-native-web#"~0.18.7" 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!
npm ERR! For a full report see:
npm ERR! C:\Users\Human\AppData\Local\npm-cache_logs\2023-02-10T03_04_04_748Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Human\AppData\Local\npm-cache_logs\2023-02-10T03_04_04_748Z-debug-0.log
I tried insalling react-native-web with npm install and I was expecting smooth installation but it says Failed to install react-native-web#~0.18.7 with error: npm exited with non-zero code: 1
I resolved this issue by doing a force install as the console messages were suggesting and then using expo doctor (again as the console messages were suggestion) to fix the dependency issue.
npm install react-native-web, react-dom --force
and once the installation is done, do:
expo doctor --fix-dependencies
My app runs successfully afterwards.

Fix the upstream dependency conflict, React Native Expo

I have a React Native Expo application, and I am trying to install expo-splash-screen with running npx expo install expo-splash-screen
As a result I get the following error message:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-navigation-drawer#2.7.2
npm ERR! Found: react-native-gesture-handler#2.5.0
npm ERR! node_modules/react-native-gesture-handler
npm ERR! peer react-native-gesture-handler#">= 1.0.0" from #react-navigation/drawer#6.5.0
npm ERR! node_modules/#react-navigation/drawer
npm ERR! #react-navigation/drawer#"^6.5.0" from the root project
npm ERR! peer react-native-gesture-handler#">= 1.5.0" from react-navigation-stack#2.10.4
npm ERR! node_modules/react-navigation-stack
npm ERR! react-navigation-stack#"^2.10.4" from the root project
npm ERR! 1 more (the root project)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-gesture-handler#"^1.0.12" from react-navigation-drawer#2.7.2
npm ERR! node_modules/react-navigation-drawer
npm ERR! react-navigation-drawer#"^2.7.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react-native-gesture-handler#1.10.3
npm ERR! node_modules/react-native-gesture-handler
npm ERR! peer react-native-gesture-handler#"^1.0.12" from react-navigation-drawer#2.7.2
npm ERR! node_modules/react-navigation-drawer
npm ERR! react-navigation-drawer#"^2.7.2" 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.
While running npm -v react-native-gessture-handler it says: 8.15.0.
I have also tried using npm i react-native-splash-screen --force but it is not good for an expo application, and I am pretty sure that installing react-navigation-drawer with --force resulted the problem.
I am not really experienced with package managing so I do not really get the point of the error message. How can I install expo-splash-screen, and can somebody explain the error message?
It looks you have libraries that use different versions of react-native-gesture-handler. react-navigation-drawer is using and older react-native-gesture-handler version and this package is deprecated so you cannot update it to use a higher version of react-native-gesture-handler.
The best solution in my opinion is to change the package react-navigation-drawer to #react-navigation/drawer as it says in the documentation of the package.
The other alternative but at your own risk is to specify in the package.json a resolution with the react-native-gesture-handler you need in expo-splash-screen and every library that have as peer dependecy react-native-gesture-handler will use this specific version.
"resolutions": {
"react-native-gesture-handler": "x.x.x"
}
Let me know if it helps

Difficulties install React Native Elements

Attempting to add React Native Elements to my project, but it's not going through.
I used react-native init <ProjectName> to initialize my project, and I attempting to follow up with npm install #rneui/themed #rneui/base, as per the instructions here, but I am given the following sequence of errors:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: react-native-safe-area-context#4.3.1
npm ERR! node_modules/react-native-safe-area-context
npm ERR! react-native-safe-area-context#"^4.3.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-safe-area-context#"^3.1.9" from #rneui/base#4.0.0-rc.4
npm ERR! node_modules/#rneui/base
npm ERR! #rneui/base#"^4.0.0-rc.4" 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 C:\Users\Kookeh\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Kookeh\AppData\Local\npm-cache\_logs\2022-06-13T20_21_44_602Z-debug-0.log
I am unsure what am I doing wrong, or what steps I can take to remedy the issue. I've been trying to get my project up and running for a few days now, but I keep running into issues like this that have few solutions when I look them up.
That's because NPM installed the latest version of the package and some libraries uses an older version.
You should edit the package.json file of your project.
Go to the file on your react native project and find the line that has the definition of react-native -safe-area-context.
The line should look like this:
"react-native-safe-area-context": "^4.3.1"
And replace the version like this:
"react-native-safe-area-context": "3.1.9"
That worked for me.

Install Pinia with Quasar v2

I'm using Quasar v2, Vue 3 and I'm trying to install Pinia.
Whenever I try to run: npm install pinia or also npm install pinia#next,
it gives me this error:
code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: ui#0.0.1
npm ERR! Found: vue#3.1.5
npm ERR! node_modules/vue
npm ERR! vue#"3.1.5" from #quasar/app#3.0.4
npm ERR! node_modules/#quasar/app
npm ERR! dev #quasar/app#"^3.0.4" from the root project
npm ERR! peer vue#"3.1.5" from #vue/compiler-sfc#3.1.5
npm ERR! node_modules/#vue/compiler-sfc
npm ERR! #vue/compiler-sfc#"3.1.5" from #quasar/app#3.0.4
npm ERR! node_modules/#quasar/app
npm ERR! dev #quasar/app#"^3.0.4" from the root project
npm ERR! peerOptional #vue/compiler-sfc#"^3.0.8" from vue-loader#16.4.1
npm ERR! node_modules/vue-loader
npm ERR! vue-loader#"16.4.1" from #quasar/app#3.0.4
npm ERR! node_modules/#quasar/app
npm ERR! dev #quasar/app#"^3.0.4" from the root project
npm ERR! 5 more (#vue/server-renderer, #vue/test-utils, vue-i18n, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! pinia#"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: vue#2.6.14
npm ERR! node_modules/vue
npm ERR! peer vue#"^2.6.14 || ^3.2.0" from pinia#2.0.2
npm ERR! node_modules/pinia
npm ERR! pinia#"*" 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 /home/gii/.npm/eresolve-report.txt for a full report.
Does anyone know how to make this work?
Moreover, since I'm using Typescript, is there a way to configure it already with it via this initial npm command?
You can install Pinia if you remove Vuex first.
Just delete Vuex from your package.json and then you are free to install Pinia.
Faced the same problem while installing pinia from npm having vuex configured in my vue3 app , after couple of try i uninstalled vuex and reinstalled pinia and then it worked fine
If you just want to get everything installed and are not concerned about possibly running incompatible versions: npm install --legacy-peer-deps.
Beyond that, your options get much more involved. You can try updating everything and cross your fingers that all the most up-to-date versions are compatible with each other. You can downgrade dependencies that require newer versions of peer dependencies. And so on.

"ERESOLVE unable to resolve dependency tree" when setting up a new project using wdio-v7

I am trying to set up a new project using wdio-v7,
firstly I ran npm init -y
then npm install #wdio/cli --save-dev
and after running npx wdio config -y I receive this:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: example-test#1.0.0
npm ERR! Found: #wdio/cli#7.0.5
npm ERR! node_modules/#wdio/cli
npm ERR! dev #wdio/cli#"^7.0.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #wdio/cli#"^6.0.0" from wdio-chromedriver-service#6.0.4
npm ERR! node_modules/wdio-chromedriver-service
npm ERR! dev wdio-chromedriver-service#"*" 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!
Initialize WebdriverIO and setup configuration in your current project.
Documentation: https://webdriver.io
#wdio/cli (v7.0.5)
I tried using --force, or --legacy-peer-deps but unsuccessful.
That is weird, looks like npx wdio config -yis trying to install older version of chrome driver service.
Try to manually install chromedriver service or update the version in package.json
"wdio-chromedriver-service": "^7.0.0"
Make sure you have the min requirements by webdriverio
https://webdriver.io/docs/gettingstarted#system-requirements
Install at least v12.16.1 or higher as this is the oldest active LTS
version Only releases that are or will become an LTS release are
officially supported