我正在使用react-native
应用,我正在使用原子文本编辑器。我正在使用此https://reactnavigation.org/blog/2017/1/Introducing-React-Navigation进行导航。我按照说法安装了react-navigation
。
npm install --save react-navigation
D:\React Native\Scheduled>npm install --save react-navigation
Scheduled@0.0.1 D:\React Native\Scheduled
`-- react-navigation@1.0.0-beta.7
+-- clamp@1.0.1
+-- hoist-non-react-statics@1.2.0
+-- path-to-regexp@1.7.0
| `-- isarray@0.0.1
+-- react-native-drawer-layout-polyfill@1.3.0
| `-- react-native-drawer-layout@1.3.0
| `-- react-native-dismiss-keyboard@1.0.0
`-- react-native-tab-view@0.0.57
希望它安装成功。完成后,我编译了一个成功的项目。
D:\React Native\Scheduled>react-native run-android
Scanning 566 folders for symlinks in D:\React Native\Scheduled\node_modules (15m
s)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat install
Debug)...
Observed package id 'add-ons;addon-google_apis-google-22' in inconsistent locati
on 'C:\Users\xyz\AppData\Local\Android\Sdk\add-ons\addon-google_apis-googl
e-22-1' (Expected 'C:\Users\xyz\AppData\Local\Android\Sdk\add-ons\addon-go
ogle_apis-google-22')
Observed package id 'add-ons;addon-google_apis-google-23' in inconsistent locati
on 'C:\Users\xyz\AppData\Local\Android\Sdk\add-ons\addon-google_apis-googl
e-23-1' (Expected 'C:\Users\xyz\AppData\Local\Android\Sdk\add-ons\addon-go
ogle_apis-google-23')
Observed package id 'add-ons;addon-google_apis-google-22' in inconsistent locati
on 'C:\Users\xyz\AppData\Local\Android\Sdk\add-ons\addon-google_apis-googl
e-22-1' (Expected 'C:\Users\xyz\AppData\Local\Android\Sdk\add-ons\addon-go
ogle_apis-google-22')
Observed package id 'add-ons;addon-google_apis-google-23' in inconsistent locati
on 'C:\Users\xyz\AppData\Local\Android\Sdk\add-ons\addon-google_apis-googl
e-23-1' (Expected 'C:\Users\xyz\AppData\Local\Android\Sdk\add-ons\addon-go
ogle_apis-google-23')
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library UP-TO-DA
TE
:app:prepareComFacebookFrescoDrawee101Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore101Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco101Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline101Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase101Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp3101Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0433Library UP-TO-DATE
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithDexForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateSigningDebug
:app:packageDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:installDebug
Installing APK 'app-debug.apk' on 'Google Nexus 6P - 7.0.0 - API 24 - 1440x2560
- 7.0' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL
Total time: 15.101 secs
Running C:\Users\xyz\AppData\Local\Android\Sdk/platform-tools/adb -s 192.1
68.79.101:5555 reverse tcp:8081 tcp:8081
Starting the app on 192.168.79.101:5555 (C:\Users\xyz\AppData\Local\Androi
d\Sdk/platform-tools/adb -s 192.168.79.101:5555 shell am start -n com.scheduled/
.MainActivity)...
Starting: Intent { cmp=com.scheduled/.MainActivity }
D:\React Native\Scheduled>
我正在使用此命令重新启动react-server
,此处我遇到问题UnableToResolveError
。
D:\React Native\Scheduled>react-native start
Scanning 566 folders for symlinks in D:\React Native\Scheduled\node_modules (15m
s)
┌────────────────────────────────────────────────────────────────────────────┐
│ Running packager on port 8081. │
│ │
│ Keep this packager running while developing on any JS projects. Feel │
│ free to close this tab and run your own packager instance if you │
│ prefer. │
│ │
│ https://github.com/facebook/react-native │
│ │
└────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
D:\React Native\Scheduled
Loading dependency graph...
React packager ready.
Loading dependency graph, done.
error: bundling: UnableToResolveError: Unable to resolve module `react/lib/React
ComponentWithPureRenderMixin` from `D:\React Native\Scheduled\node_modules\react
-navigation\src\views\Header.js`: Module does not exist in the module map or in
these directories:
D:\React Native\Scheduled\node_modules\react\lib
, D:\React Native\node_modules\react\lib
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start --reset-cache`
.
at UnableToResolveError (D:/React Native/Scheduled/node_modules/react-native
/packager/src/node-haste/DependencyGraph/ResolutionRequest.js:488:5)
at p.catch.error (D:/React Native/Scheduled/node_modules/react-native/packag
er/src/node-haste/DependencyGraph/ResolutionRequest.js:366:19)
at process._tickCallback (internal/process/next_tick.js:103:7)
Bundling `index.android.js` 85.5% (492/532), failed.
我不确定安装react-navigation
之后出了什么问题,它已经停止了,它在它之前工作。
答案 0 :(得分:1)
与我同样的问题。只需删除border-color: currentColor;
中的12行代码(导入ReactComponentWithPureRenderMixin
但在反应中不存在且从未使用过)。
答案 1 :(得分:0)
您可以在npm中使用react-native-router-flux
包在react-native中进行路由。
答案 2 :(得分:0)
这种情况经常发生在我身上,我无法找到问题所在,但主要是当我使用" babael"它发生了。 重建应用程序将解决问题。 并且三步作为反应建议你将是有用的
watchman watch-del-all
。node_modules
文件夹:rm -rf node_modules && npm install
。rm -fr $TMPDIR/react-*
或npm start --reset-cache