我是ReactNative开发的新手,我正在尝试将NativeBase 2.2.0导入到我的项目中。我按照这个指示 Getting started
步骤:
$react-native init MyProject
$cd MyProject
$react-native run-android
在手机上成功安装应用程序后,我尝试安装NativeBase
$npm install native-base --save
native-base@2.3.3 postinstall \ MyProject e_modules \ native-base node addEjectScript.js
┌────────────────────────────────────────────── ───────────────────────────── ──────────────86岁的NativeBase 2.0已经成功安装! ││运行
node node_modules/native-base/ejectTheme.js
复制主题配置变量。 ││前往文档 有关如何更改血红素的详细信息。 │ └───────────────────────────────────────────────── ────────────────────────── ───────────npmnotice创建了一个lockfile作为package-lock.json。您 应该提交这个fnpm WARN native-base@2.3.3需要一个反应同伴@> = 16.0.0-alpha.3 但没有安装。您必须自己安装对等依赖项。 NPM WARN native-base@2.3.3需要一个react-native @> = 0.46.0的对等体 没有安装。您必须自己安装对等依赖项。警告 native-base-shoutem-theme@0.2.1需要react-native @> = 0 0的对等体 但没有安装。您必须自己安装对等依赖项。 npm WARN native-base-shoutem-theme@0.2.1需要同行 react @> = 16.0.0-a .3但没有安装。你必须安装同行 依赖自己。
- native-base@2.3.3在78.962s中添加了22个软件包,删除了625个软件包并更新了91个软件包
但是当我进入Install Peer Dependencies
步骤时,我收到了错误
$react-native link
命令
link
无法识别。确保您已运行npm install
而且你在一个反应原生的项目中。
然后我尝试:
$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
尝试安装应用时遇到错误。
$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)
环境
- node --version
v6.11.5
- react-native --version
react-native-cli:2.0.1
react-native:不适用 - 不在React Native项目目录中
- npm --version
5.5.1
我做错了什么或错过了什么吗?
有人可以帮忙吗?
谢谢。
答案 0 :(得分:1)
native-base@2.3.3在78.962s中添加了22个软件包,删除了625个软件包并更新了91个软件包
这很奇怪。我正在与原生基地合作,但之前没有看到过。再次安装本机基站后运行npm install
。
如果无法运行npm install react
和npm install react-native
它应该有用。