GeekyAnts / NativeBase

Mobile-first, accessible components for React Native & Web to build consistent UI across Android, iOS and Web.
https://nativebase.io/
MIT License
20.18k stars 2.39k forks source link

Dependency issue: Setup new React Native App #5259

Open adnansiddiq opened 2 years ago

adnansiddiq commented 2 years ago

Description

Dependency issue while creating new react native app using native base template.

CodeSandbox/Snack link

https://snack.expo.dev/adnansiddiq

Steps to reproduce

  1. react-native --version => 8.0.5
  2. node -v => v16.16.0
  3. nvm -v => 8.16.0
  4. npx react-native init SafeApp --template @native-base/react-native-template

Error: ✔ Downloading template ✔ Copying template ✔ Processing template ✖ Installing dependencies

error Error: Command failed: npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: safeapp@0.0.1
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   react@"17.0.1" from the root project
npm ERR!   peer react@"*" from native-base@3.4.0
npm ERR!   node_modules/native-base
npm ERR!     native-base@"3.4.0" 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@"*" from native-base@3.4.0
npm ERR!   node_modules/native-base
npm ERR!     native-base@"3.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/adnansiddiq/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/adnansiddiq/.npm/_logs/2022-08-09T11_50_15_538Z-debug-0.log

NativeBase Version

3.4.x

Platform

Other Platform

Mac

Additional Information

Screenshot 2022-08-09 at 4 50 45 PM
Viraj-10 commented 2 years ago

Hi @adnansiddiq, Can you try using node version v16.13.0? There seems to be an issue with later versions. we will try to fix it soon.

adnansiddiq commented 2 years ago

Hi @Viraj-10 thanks for quick response.

I am getting same error using node v16.16.0 npm v8.1.0 react-native 8.0.5

Screenshot 2022-08-10 at 8 35 01 PM
rohankleem commented 2 years ago

Hi, also having issues installing Native Base via npm to react native 0.69.4 Theme using command "npm install native-base react-native-svg@12.1.1 react-native-safe-area-context@3.3.2" (docs at https://docs.nativebase.io/install-rn), results in error: code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: myapp@0.0.1 npm ERR! Found: react@18.0.0 npm ERR! node_modules/react npm ERR! react@"18.0.0" from the root project npm ERR! peer react@"" from native-base@3.4.12 npm ERR! node_modules/native-base npm ERR! native-base@"" 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@"" from native-base@3.4.12 npm ERR! node_modules/native-base npm ERR! native-base@"" 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.

Thanks

Viraj-10 commented 2 years ago

Hi @rohankleem, Can you share your environment details? Please run npx native-base-info in your project and paste the logs.

rohankleem commented 2 years ago

@Viraj-10

lSystem: OS: macOS 12.5 CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz Memory: 16.45 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 18.7.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.17.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: API Levels: 28, 29, 31 Build Tools: 28.0.3, 29.0.3, 30.0.3, 31.0.0 System Images: android-28 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-31 | Intel x86 Atom_64 IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8815526 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild npmPackages: react: 18.0.0 => 18.0.0 react-native: 0.69.4 => 0.69.4

Viraj-10 commented 2 years ago

@rohankleem, Can you please try installing template with node v16.13.0. Use nvm to switch between node versions. We will soon solve the problem for node v16.14 and above.

rohankleem commented 2 years ago

@Viraj-10, changed my running node version to 16.3.0 and tried to install NativeBase again, got similar error. When you say "installing template", do you mean re-install the react-native app init using the with Native Base template? In my current project I have installed React Native on its own and then I want to add Native Base to an existing project, using that option which is also documented.

$ nvm install 16.3.0 Downloading and installing node v16.3.0... Downloading https://nodejs.org/dist/v16.3.0/node-v16.3.0-darwin-x64.tar.xz... ##################100.0% Computing checksum with shasum -a 256 Checksums matched! Now using node v16.3.0 (npm v7.15.1) Creating default alias: default -> 16.3.0 (-> v16.3.0) $ nvm use 16.3.0 Now using node v16.3.0 (npm v7.15.1)

$ npm install native-base react-native-svg@12.1.1 react-native-safe-area-context@3.3.2 npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: undefined@undefined npm ERR! Found: react@18.2.0 npm ERR! node_modules/react npm ERR! peer react@"" from native-base@3.4.12 npm ERR! node_modules/native-base npm ERR! native-base@"" from the root project npm ERR! peer react@"^18.2.0" from react-dom@18.2.0 npm ERR! node_modules/react-dom npm ERR! peer react-dom@"" from native-base@3.4.12 npm ERR! node_modules/native-base npm ERR! native-base@"" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"18.0.0" from react-native@0.69.4 npm ERR! node_modules/react-native npm ERR! peer react-native@"" from native-base@3.4.12 npm ERR! node_modules/native-base npm ERR! native-base@"" 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/rohankleem/.npm/eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! /Users/rohankleem/.npm/_logs/2022-08-15T10_50_41_769Z-debug.log

rohankleem commented 2 years ago

I have resorted to setting up an app using your template version, but seems to have setup the app with react native -v 0.64.0, 5 behind the latest version 0.69

I notice now this has been raised elsewhere too.

A reply on whether recent versions of react native and node can be used or not would be appreciated , and if not when. Thanks.

Viraj-10 commented 2 years ago

Hi @rohankleem, use --legacy-peer-deps.

ghulamyazdani commented 1 year ago

Hey This issue still exist for newer versions of node and npm

image

Node version -

image