NativeBase: When native-based is installed, expo prints the following error: "Error: React native is not installed. Please run `npm install` in your project directory."
Summary
- I have created a new expo project. When I install native-base using npm and I am trying to reopen the project in expo, I get the following message:
Error: React native is not installed. Please run `npm install` in your project directory.
Running npm install doesn’t solve the problem.
Using yarn instead of npm doesn’t solve the problem.
Environment
Running expo on windows 10
package.json
{
"name": "my-new-project",
"main": "node_modules/expo/AppEntry.js",
"private": true,
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject",
"test": "node ./node_modules/jest/bin/jest.js --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/samples": "2.1.1",
"expo": "29.0.0",
"native-base": "^2.7.2",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",
"react-navigation": "^2.9.3"
},
"devDependencies": {
"jest-expo": "29.0.0"
}
}
Expected behaviour
To open the project in expo without errors
Actual behaviour
See in summary above
In addition, when I run npm install native-based --save, I get the following messages:
npm WARN deprecated istanbul-lib-hook@1.2.1: 1.2.0 should have been a major version bump
> native-base@2.7.2 postinstall C:\esites-native\temp\node_modules\native-base
> node addEjectScript.js
┌────────────────────────────────────────────────────────────────────────────────────────────┐
│ NativeBase 2.0 has been succesfully installed! │
│ Run `node node_modules/native-base/ejectTheme.js` to copy over theme config and variables. │
│ Head over to the docs for detailed information on how to make changes to the theme. │
└────────────────────────────────────────────────────────────────────────────────────────────┘
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN jest-expo@29.0.0 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN react-navigation@2.9.3 requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN react-navigation@2.9.3 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN native-base@2.7.2 requires a peer of react@>=16.4.1 but none is installed. You must install peer dependencies yourself.
npm WARN native-base@2.7.2 requires a peer of react-native@>=0.56.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-keyboard-aware-scroll-view@0.5.0 requires a peer of react-native@>=0.48.4 but none is installed. You must install peer dependencies yourself.
npm WARN jest-react-native@18.0.0 requires a peer of react-native@>=0.38.0 but none is installed. You must install peer dependencies yourself.
npm WARN native-base-shoutem-theme@0.2.2 requires a peer of react@>=16.0.0-alpha.3 but none is installed. You must install peer dependencies yourself.
npm WARN native-base-shoutem-theme@0.2.2 requires a peer of react-native@>=0.43.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-iphone-x-helper@1.0.3 requires a peer of react-native@>=0.42.0 but none is installed. You must install peer dependencies yourself.
npm WARN expo-camera@1.0.0 requires a peer of react-native@^0.55.4 but none is installed. You must install peer dependencies yourself.
npm WARN expo-gl@1.0.0 requires a peer of react-native@^0.55.4 but none is installed. You must install peer dependencies yourself.
npm WARN lottie-react-native@2.5.0 requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN lottie-react-native@2.5.0 requires a peer of react-native@>=0.46 but none is installed. You must install peer dependencies yourself.
npm WARN expo-react-native-adapter@1.0.0 requires a peer of react@^16.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN expo-react-native-adapter@1.0.0 requires a peer of react-native@^0.55.4 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-branch@2.2.5 requires a peer of react-native@>=0.40.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-gesture-handler@1.0.6 requires a peer of react@> 15.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-gesture-handler@1.0.6 requires a peer of react-native@>= 0.50.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-maps@0.21.0 requires a peer of react@^16.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-maps@0.21.0 requires a peer of react-native@^0.51 || ^0.52 || ^0.53 || ^0.54 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-svg@6.2.2 requires a peer of react-native@>=0.50.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-svg@6.2.2 requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN expo-sms@1.0.0 requires a peer of react-native@^0.55.4 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-reanimated@1.0.0-alpha.3 requires a peer of react@16.0.0-alpha.6 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-reanimated@1.0.0-alpha.3 requires a peer of react-native@^0.44.1 but none is installed. You must install peer dependencies yourself.
npm WARN expo-core@1.0.1 requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN expo-core@1.0.1 requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN expo-core@1.0.1 requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN expo-core@1.0.1 requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN expo-core@1.0.1 requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN expo-core@1.0.1 requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN expo-core@1.0.1 requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-safe-module@1.2.0 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN react-test-renderer@16.4.1 requires a peer of react@^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-safe-area-view@0.8.0 requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-safe-area-view@0.8.0 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN create-react-context@0.2.2 requires a peer of react@^0.14.0 || ^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-navigation-deprecated-tab-navigator@1.3.0 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN react-navigation-drawer@0.4.3 requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN react-navigation-drawer@0.4.3 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN react-navigation-tabs@0.5.1 requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN react-navigation-tabs@0.5.1 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-tab-view@1.0.2 requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-tab-view@1.0.2 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-safe-area-view@0.7.0 requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-safe-area-view@0.7.0 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-tab-view@0.0.77 requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-tab-view@0.0.77 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout-polyfill@1.3.2 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout@1.3.2 requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout@1.3.2 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ native-base@2.7.2
added 110 packages from 74 contributors, removed 393 packages, updated 618 packages and audited 26831 packages in 80.881s
Steps to reproduce should include code snippet and screenshot. Include code snippet in preformatted mode (code)
- Create a new expo project
- install native-base using
npm install --save
See also in Any other additional info below. Using yarn doesn’t solve the problem.
Is the bug present in both iOS and Android or in any one of them?
Errors received before running the code
Any other additional info
Using yarn instead of npm, I get the following messages:
Warning: 'react' peer dependency missing. Run `npm ls` in C:\esites-native\temp to see full warning.
Warning: 'react-native' peer dependency missing. Run `npm ls` in C:\esites-native\temp to see full warning.
If there is an issue running your project, please run `npm install` in C:\esites-native\temp and restart.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (6 by maintainers)
Did you try clearing node_modules, lock files and install again?
I have had same issue about my project which is established via expo cli. What I do is just npm install under the project directory and the error gone.
I deleted node_modules , then run yarn to re-install , and it work
You are right. with the CLI it works as you wrote.
I should have said this earlier: I appreciate very much the prompt replies! It will help me use native-base. Thank you! 🙏
This was never an issue with expo before