0

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

native-base@2.3.3 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 native-base@2.3.3 requires a peer of react@>=16.0.0-alpha.3 but non installed. You must install peer dependencies yourself. npm WARN native-base@2.3.3 requires a peer of react-native@>=0.46.0 but none installed. You must install peer dependencies yourself. npm WARN native-base-shoutem-theme@0.2.1 requires a peer of react-native@>=0 0 but none is installed. You must install peer dependencies yourself. npm WARN native-base-shoutem-theme@0.2.1 requires a peer of react@>=16.0.0-a .3 but none is installed. You must install peer dependencies yourself.

  • native-base@2.3.3 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 react-native@0.49.5 requires a peer of react@16.0.0-beta.5 but none is installed. You must install peer dependencies yourself.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    react@16.0.0 added 115 packages, removed 15 packages and updated 1 package in 20.176s


 $npm install react-native
    npm WARN deprecated connect@2.30.2: connect 2.x series is deprecated
npm WARN react-native@0.49.5 requires a peer of react@16.0.0-beta.5 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ react-native@0.49.5
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.

neo
  • 618
  • 1
  • 10
  • 29
  • Anyone can help. I still stuck at this. It's pissing me off orz. It's seem so complicate to configure environment, right ? – neo Nov 03 '17 at 07:35

1 Answers1

1

native-base@2.3.3 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.

Sinapcs
  • 2,495
  • 1
  • 20
  • 23
  • I did the same steps as you said and installed app successfully. But I still get the error when try 'react-native link'. I have stuck at this for few days. – neo Nov 01 '17 at 06:14
  • check your node_modules/react/package.json and node_modules/react-native/package.json and let me know version of these packages – Sinapcs Nov 01 '17 at 07:39
  • I tried 'npm install react' and 'npm install react-native' after that 'react-native link' work. But when I tried 'react-native run-android' then I got error ==> { 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-nat‌​ive\\react-native-im‌​plementation.js") } . I edited my question. Could you see it Thanks – neo Nov 02 '17 at 02:16
  • after installing react-native try `react-native upgrade` and then `react-native run-android` – Sinapcs Nov 03 '17 at 09:57