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."

Created on 26 Aug 2018  ยท  17Comments  ยท  Source: GeekyAnts/NativeBase

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 [email protected]: 1.2.0 should have been a major version bump

> [email protected] 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 [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@>=16.4.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@>=0.56.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@>=0.48.4 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@>=0.38.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@>=16.0.0-alpha.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@>=0.43.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@>=0.42.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@^0.55.4 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@^0.55.4 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@>=0.46 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^16.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@^0.55.4 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@>=0.40.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@> 15.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@>= 0.50.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^16.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] 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 [email protected] requires a peer of react-native@>=0.50.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@^0.55.4 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@^0.44.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of expo-react-native-adapter@^1.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] 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 [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ [email protected]
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.
awaiting response

Most helpful comment

Did you try clearing node_modules, lock files and install again?

All 17 comments

@rahamin1 I guess the issue is when React Native version is specified in this format, "react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz"

@SupriyaKalghatgi Thanks, but this is expo's default... Shouldn't native-base work with expo as is?

This was never an issue with expo before

But there is a problem now... When posting this, I hoped that native-base people would like to fix it, since I am probably not the only one who wants to use expo with native.

Unless you have another suggestion on how to solve this, without making changes in native-base...

Did you try clearing node_modules, lock files and install again?

Yes, I did.

Did that help?

No, it did not. I also deleted node_modules and lock files and tried with yarn install. Didn't work either. It is very easy to try, no need to run any code, just to create an expo app with latest version (I chose the 'new app with tab navigation), then install native-base, close the project and open it again. You will see the error.

I chose new app with blank template, installed NativeBase with npm - failed
Cleared node_modules, lock files, installed again - worked

I did the same and I still get the same error. Maybe we have different expo XDE versions...
My version is 2.24.4, on Windows 10.

I dd'nt go with XDE way
I go with cli

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! ๐Ÿ™

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

Hello, I'm having an issue somewhat related. This is the error Log...

[22:46:02] Error: node_modules directory is missing. Please run npm install in your project directory.
[22:46:02] Couldn't start project. Please fix the errors and restart the project

I have types in npm install. It doesn't seem like it is actually installing the files I need

please help me. react native is not installed .....

It worked for me @kingasawa!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bsiddiqui picture bsiddiqui  ยท  3Comments

natashache picture natashache  ยท  3Comments

nschurmann picture nschurmann  ยท  3Comments

Bundas picture Bundas  ยท  3Comments

Landerson352 picture Landerson352  ยท  3Comments