You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
npm install fails with react 17.0.1 and react-native 0.64.0 #2603
Reacted by Justin Latimore, ice-hector, Yosef S Adelman, Raj , itxhamzajaved, Osama Ahmed, prakharINF, Salvatore Manna and Alauddin Ahmed
Reacted by Manu, Nik Khilnani, mbalc, keithgoodwin, Ihor, Roberto Wesley Overdijk, Rasmey SARETH, Edson Dos Santos, Stefan Morcodeanu, DSJS and 94 more
When trying to install dependencies (by using npm install) i'm getting:
@callstack/react-theme-provider@3.0.5 requires a peer of react@^16.3.0 but none is installed. You must install peer dependencies yourself.
react-theme-provider in version 3.0.5 is dependency of react-native-paper in version 4.7.2
I'm not sure but maybe this mismatch in required versions is causing problem.
tldr: looks like this is a bug in NPM not an issue with react-native-paper, try adding --force to your npm install command for now (or use Yarn).
I think this issue isn't specific to react-native-paper, I'm getting the same from installing react-navigation.
It appears to be caused by (a bug in?) NPM 7's new strictness in handling peer dependencies:
react-native-paper (and many others) says "I'm happy with any version of react" (peer dep react: "*")
NPM7 says "Okay, here's the latest, 17.0.2"
react-native-paper (and many others) says "I'm happy with any version of react-native" (peer dep react-native: "*")
NPM7 says "Okay, here's the latest, 0.64.0"
react-native 0.64.0 says "I specifically want react 17.0.1 please" (peer dep react: "17.0.1", it's 17.0.2 in the next release but that's not out yet)
NPM7 says "BUT WE'VE ALREADY INSTALLED 17.0.2! THIS IS A DISASTER" and crashes
Yarn in the same situation just installs React 17.0.1, and everyone is happy. I'd call this a bug in NPM and it looks like I'm not alone: NPM bug report npm/cli#3083 and PR npm/arborist#266
In the meantime, this current NPM7 behaviour can be temporarily bypassed by either:
Passing --force, which outputs warnings instead of crashing (I'd try this first)
Passing --legacy-peer-deps, which doesn't install any missing peer dependencies (like NPM <=6)
Update May 2021 - The NPM bug is still there, the above-linked PR failed to fix it, they've opened a new issue npm/cli#3171 so we still need to keeping using --force (or, switch to Yarn).
Reacted by Dror-Bar, FZs, Jeremias Araujo, Colin Cowles, Christopher DATO, Ivan Cézanne Seara, Kumar Gaurav, Ved-evitpl, Daniel T and forandoe
I have what I believe is this problem, still. I’m using react 17.0.1 and react native 0.64.2. I’ve tried installing with yarn and with npm. I’ve tried upgrading node to 16.x with npm 7.x and then back to 14.x with npm 6.14.14.
I’m doing a full rebuild of the project every time, including removing node_modules and lock file(s), doing a full pod install after removing Podfile.lock, clearing bundler cache, and cleaning the build folder before building in xcode. Just no joy.
My error is consistently:
error Unable to resolve module fs from /Users/(user)/(project path)/node_modules/firebase-admin/lib/firebase-namespace.js: fs could not be found within the project or in these directories:
node_modules
Ironically, installing with yarn worked fine for me just yesterday. Perhaps I have another issue and this thread is just a red herring... :(
Edit:
Aha! I discovered that there are (weirdly) two ways you can import firebase-admin into react native projects. I guess I was doing import { firestore } from "firebase-admin" and I needed to be doing import firestore from '@react-native-firebase/firestore' So, this was indeed a red herring, but I’ll leave my comment around in case anyone else with my problem finds this thread while looking for a solution. Carry on!
Thanks to the PR the issue should be fixed, however we are planning the release in the upcoming weeks, so in the meantime you can try install from the main branch.
I had this issue and nothing seemed to work. I fixed it by downgrading node to version 12.14.1 Uninstall the current node version and install 12.14.1 from this link.
Activity
github-actions commentedon Mar 15, 2021
Couldn't find version numbers for the following packages in the issue:
react-native-vector-iconsnpmyarnexpoCan you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.
github-actions commentedon Mar 15, 2021
Couldn't find version numbers for the following packages in the issue:
react-native-vector-iconsnpmexpoCan you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
yarn(found:7.6.3, latest:1.22.10)Can you verify that the issue still exists after upgrading to the latest versions of these packages?
github-actions commentedon Mar 15, 2021
Couldn't find version numbers for the following packages in the issue:
react-native-vector-iconsyarnexpoCan you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.
hussainahmad commentedon Mar 16, 2021
+1 unable to install
react-native-paperwith latestreact-native.kuasha420 commentedon Mar 17, 2021
Yarn can install react native paper on a freshly generated RN64 Project .
geovrisco commentedon Mar 18, 2021
im using npm but get the same error, any workaround for this particular issue?
raajnadar commentedon Mar 18, 2021
use yarn it will resolve many issues.
kuasha420 commentedon Mar 18, 2021
Very odd, I've just installed paper after creating a fresh project with typescript template.
siof commentedon Apr 1, 2021
Using:
"react": "17.0.1"
"react-native": "0.64.0"
"react-native-paper": "^4.7.2"
"npm": "^6.14.11"
When trying to install dependencies (by using npm install) i'm getting:
@callstack/react-theme-provider@3.0.5 requires a peer of react@^16.3.0 but none is installed. You must install peer dependencies yourself.
react-theme-provider in version 3.0.5 is dependency of react-native-paper in version 4.7.2
I'm not sure but maybe this mismatch in required versions is causing problem.
nalzayat commentedon Apr 9, 2021
Having this problem as well on a fresh new react-native ts template when using npm.
"react": "17.0.1"
"react-native": "0.64.0"
"react-native-paper": "^4.7.2"
"npm": "^7.7.6"
I used yarn instead and it worked.
RishabhKarnad commentedon Apr 19, 2021
For those using npm 7, for now, these options seem to work
--legacy-peer-depsflag when using npm commandsOriginal answer on stackoverflow: https://stackoverflow.com/a/65568080
AlanSl commentedon Apr 19, 2021
tldr: looks like this is a bug in NPM not an issue with
react-native-paper, try adding--forceto your npm install command for now (or use Yarn).I think this issue isn't specific to
react-native-paper, I'm getting the same from installingreact-navigation.It appears to be caused by (a bug in?) NPM 7's new strictness in handling peer dependencies:
react-native-paper(and many others) says "I'm happy with any version ofreact" (peer depreact: "*")react-native-paper(and many others) says "I'm happy with any version ofreact-native" (peer depreact-native: "*")react-native0.64.0 says "I specifically wantreact17.0.1 please" (peer depreact: "17.0.1", it's 17.0.2 in the next release but that's not out yet)Yarn in the same situation just installs React 17.0.1, and everyone is happy. I'd call this a bug in NPM and it looks like I'm not alone: NPM bug report npm/cli#3083 and PR npm/arborist#266
In the meantime, this current NPM7 behaviour can be temporarily bypassed by either:
--force, which outputs warnings instead of crashing (I'd try this first)--legacy-peer-deps, which doesn't install any missing peer dependencies (like NPM <=6)Update May 2021 - The NPM bug is still there, the above-linked PR failed to fix it, they've opened a new issue npm/cli#3171 so we still need to keeping using
--force(or, switch to Yarn).bhargav29dev commentedon May 4, 2021
i was having same issue with npm
$ npm i react-native-paper
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR! peer react@"17.0.1" from react-native@0.64.0
npm ERR! node_modules/react-native
npm ERR! peer react-native@">=0.64.0-rc.0 || 0.0.0-" from @react-native-community/cli@5.0.1-alpha.2
npm ERR! node_modules/@react-native-community/cli
npm ERR! @react-native-community/cli@"^5.0.1-alpha.0" from react-native@0.64.0
npm ERR! react-native@"0.64.0" from the root project
npm ERR! 1 more (react-native-paper)
npm ERR! peer react@"^16.0.0 || ^17.0.0" from react-shallow-renderer@16.14.1
npm ERR! node_modules/react-shallow-renderer
npm ERR! react-shallow-renderer@"^16.13.1" from react-test-renderer@17.0.1
npm ERR! node_modules/react-test-renderer
npm ERR! dev react-test-renderer@"17.0.1" from the root project
npm ERR! 4 more (react-test-renderer, use-subscription, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.3.0" from @callstack/react-theme-provider@3.0.5
npm ERR! node_modules/react-native-paper/node_modules/@callstack/react-theme-provider
npm ERR! @callstack/react-theme-provider@"^3.0.5" from react-native-paper@4.8.1
npm ERR! node_modules/react-native-paper
npm ERR! react-native-paper@"" 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\DELL\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\DELL\AppData\Local\npm-cache_logs\2021-05-04T12_20_14_663Z-debug.log
kuasha420 commentedon May 4, 2021
for NPM v7 use
npm i --legacy-peer-depsor use yarn.
hi337 commentedon May 15, 2021
+1 same error. Are you sure running the command with --force doesn't break things
aboodtech commentedon May 15, 2021
I got it working at the end by uninstalling latest nodeJS version (16x) and made sure my PATH only points at the stable version (14.15.1).
DONT use latest version of node, instead use the stable (recommended one)
chandniKkpl commentedon Jul 8, 2021
not work for me
xuya227939 commentedon Jul 25, 2021
@RishabhKarnad Thanks,It works for me.
SaadWaheed10 commentedon Aug 1, 2021
try yarn!
it worked for me.
Selenestica commentedon Aug 4, 2021
npm i --legacy-peer-depsdidn't work for me, butnpm i react-native-paper --forcedid work.razavistag commentedon Aug 19, 2021
Thank you mate this works for me on
npm i --legacy-peer-depsnpm install @ant-design/react-native --savekevincoleman commentedon Aug 30, 2021
I have what I believe is this problem, still. I’m using react 17.0.1 and react native 0.64.2. I’ve tried installing with yarn and with npm. I’ve tried upgrading node to 16.x with npm 7.x and then back to 14.x with npm 6.14.14.
I’m doing a full rebuild of the project every time, including removing
node_modulesand lock file(s), doing a fullpod installafter removing Podfile.lock, clearing bundler cache, and cleaning the build folder before building in xcode. Just no joy.My error is consistently:
Ironically, installing with yarn worked fine for me just yesterday. Perhaps I have another issue and this thread is just a red herring... :(
Edit:
Aha! I discovered that there are (weirdly) two ways you can import firebase-admin into react native projects. I guess I was doing
import { firestore } from "firebase-admin"and I needed to be doingimport firestore from '@react-native-firebase/firestore'So, this was indeed a red herring, but I’ll leave my comment around in case anyone else with my problem finds this thread while looking for a solution. Carry on!lukewalczak commentedon Oct 15, 2021
Thanks to the PR the issue should be fixed, however we are planning the release in the upcoming weeks, so in the meantime you can try install from the
mainbranch.liskibruh commentedon Jul 5, 2022
I had this issue and nothing seemed to work. I fixed it by downgrading node to version 12.14.1 Uninstall the current node version and install 12.14.1 from this link.
IsiteYves commentedon Aug 3, 2022
yarn installseems to resolve the issue on my side too!👌Dat-Mobile commentedon Apr 30, 2023
I always use this
npm i --force