react-native-boilerplate: [BUG]: Could not resolve dependencies on npm install
react-native environment setup
- I verified that I have not react-native-cli installed globally and be up to date about the React Native environment setup.
Description
When using the react-native initialization command line tool provided by your Installation Guide, the command fails to run npm install due to unresolved dependencies related to eslint
Steps to reproduce
- Run
npx react-native init MyApp --template @thecodingmachine/react-native-boilerplate - Press
Nwhen prompted for Typescript
Console log
Welcome to React Native!
Learn once, write anywhere
β Downloading template
β Copying template
β Processing template
β π Using typescript ? (y/N)
β¦ no
TheCodingMachine React-Native Boilerplate initialized with success ! π
- π If you need to read more about this boilerplate : https://thecodingmachine.github.io/react-native-boilerplate/
- π€ If you have some troubles : https://github.com/thecodingmachine/react-native-boilerplate/issues
- β If you love this boilerplate, give us a star, you will be a ray of sunshine in our lives :) https://github.com/thecodingmachine/react-native-boilerplate
β Executing post init script
β Installing dependencies
error Error: Command failed: npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: eslint-plugin-jest@24.3.5
npm ERR! Found: @typescript-eslint/eslint-plugin@3.10.1
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR! @typescript-eslint/eslint-plugin@"^3.1.0" from @react-native-community/eslint-config@2.0.0
npm ERR! node_modules/@react-native-community/eslint-config
npm ERR! dev @react-native-community/eslint-config@"^2.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @typescript-eslint/eslint-plugin@">= 4" from eslint-plugin-jest@24.3.5
npm ERR! node_modules/eslint-plugin-jest
npm ERR! dev eslint-plugin-jest@"^24.3.5" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @typescript-eslint/eslint-plugin@5.12.0
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR! peerOptional @typescript-eslint/eslint-plugin@">= 4" from eslint-plugin-jest@24.3.5
npm ERR! node_modules/eslint-plugin-jest
npm ERR! dev eslint-plugin-jest@"^24.3.5" 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 .npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! .npm/_logs/2022-02-16T23_36_09_416Z-debug-0.log
Version
Latest (3.2.4)
On which OS this issue appear on?
- IOS
- Android
Desktop OS
MacBook Pro M1, Monterey 12.0.1
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16
Unfortunatelly itβs not an environment-specific issue. I have just installed the boilerplate following the tutorial and by the chance, I am doing it on a brand new Mac, so I had to install everything from scratch (homebrew, npm, literally everything) on a newest version of OS.
The same error occured:
So this is really unlikely to be coincidence.
I am by no means a React Native expert, and I am not sure if there are any side-effects of this change, but downgrading this library by one major version (24 to 23) in package.json fixes the issue:
I have the same problem with
eslint-plugin-jestusing node v16.14.0 and npm v8.3.1. On the other hand, I have tried with node v14.18.1 and npm v6.14.15 and everything has gone well.