neo
neo

Reputation: 737

How to import NativeBase 2.2.0 to ReactNative project?

I am a newbie in ReactNative development and I am trying to import NativeBase 2.2.0 to my project. I follow this instruction Getting started

Steps:

 $react-native init MyProject
    $cd MyProject
    $react-native run-android

After successful install the app on my phone, I try to install NativeBase

$npm install native-base --save

[email protected] postinstall \MyProject e_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 confi d variables. │ │ Head over to the docs for detailed information on how to make changes to t heme. │ └─────────────────────────────────────────────────────────────────────────── ─────────────┘ npm notice created a lockfile as package-lock.json. You should commit this f

npm WARN [email protected] requires a peer of react@>=16.0.0-alpha.3 but non installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react-native@>=0.46.0 but none installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react-native@>=0 0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react@>=16.0.0-a .3 but none is installed. You must install peer dependencies yourself.

  • [email protected] added 22 packages, removed 625 packages and updated 91 packages in 78.962s

But when I go to Install Peer Dependencies step, I got error

$react-native link

Command link unrecognized. Make sure that you have run npm install and you are inside a react-native project.

Then I try :

 $npm install react
    npm WARN [email protected] requires a peer of [email protected] 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 115 packages, removed 15 packages and updated 1 package in 20.176s


 $npm install react-native
    npm WARN deprecated [email protected]: connect 2.x series is deprecated
npm WARN [email protected] requires a peer of [email protected] 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 115 packages, removed 15 packages and updated 1 package in 189.374s

$react-native link
 Scanning folders for symlinks in ..\ReactNative\MyAsset\node_modules (40ms)
rnpm-install info Linking assets to ios project
rnpm-install info Linking assets to android project
rnpm-install info Assets have been successfully linked to your project

I got error when try to install app.

 $react-native run-android
       React packager ready.
    Loading dependency graph, done.
    Bundling `index.js`  [development, non-minified]  0.0% (0/418), failed.
    error: bundling failed: Error: Cannot find module 'AccessibilityInfo' (While processing preset: "MyProject\\node_modules\\react-native\\Libraries\\react-native\\react-native-implementation.js")
        at Function.Module._resolveFilename (module.js:527:15)
        at Function.Module._load (module.js:476:23)
        at Module.require (module.js:568:17)
        at require (internal/module.js:11:18)
        at Object.get AccessibilityInfo [as AccessibilityInfo] (MyProject\node_modules\react-native\Libraries\react-native\react-native-implementation.js:19:36)
        at MyProject\node_modules\babel-core\node_modules\lodash\_baseClone.js:145:23
        at arrayEach (MyProject\node_modules\babel-core\node_modules\lodash\_arrayEach.js:15:9)
        at baseClone (MyProject\node_modules\babel-core\node_modules\lodash\_baseClone.js:142:3)
        at cloneDeepWith (MyProject\node_modules\babel-core\node_modules\lodash\cloneDeepWith.js:37:10)

Environment
- node --version
v6.11.5
- react-native --version
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
- npm --version
5.5.1

Did I do something wrong or missing something here? Anyone can help?
Thanks.

Upvotes: 0

Views: 1073

Answers (1)

Sinapcs
Sinapcs

Reputation: 2745

[email protected] added 22 packages, removed 625 packages and updated 91 packages in 78.962s

it's odd. I'm working with native-base but didn't see this before.

run npm install after installing native base again.

if it not worked run npm install react and npm install react-native

it should work.

Upvotes: 1

Related Questions