UnableToResolveError while 运行 响应本机应用程序
UnableToResolveError while running react native app
我正在开发 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
它卡住了,它之前工作正常。
您可以在 npm 中使用 react-native-router-flux
包在 react-native 中进行路由。
link : https://www.npmjs.com/package/react-native-router-flux
这种情况经常发生在我身上,我找不到问题出在哪里,但大多数情况下,当我使用 "babael" 时,它就会发生。
重建应用程序将解决问题。
和反应的三个步骤表明你会很有用
- 清除守望者手表:
watchman watch-del-all
.
- 删除
node_modules
文件夹:rm -rf node_modules && npm install
。
- 重置打包程序缓存:
rm -fr $TMPDIR/react-*
或 npm start --reset-cache
.
和我一样的问题。只需删除 yourproject\node_modules\react-navigation\src\views\Header.js
中的 12 行代码( import ReactComponentWithPureRenderMixin
但在 react 中不存在且从未使用过)就可以了。
我正在开发 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
它卡住了,它之前工作正常。
您可以在 npm 中使用 react-native-router-flux
包在 react-native 中进行路由。
link : https://www.npmjs.com/package/react-native-router-flux
这种情况经常发生在我身上,我找不到问题出在哪里,但大多数情况下,当我使用 "babael" 时,它就会发生。 重建应用程序将解决问题。 和反应的三个步骤表明你会很有用
- 清除守望者手表:
watchman watch-del-all
. - 删除
node_modules
文件夹:rm -rf node_modules && npm install
。 - 重置打包程序缓存:
rm -fr $TMPDIR/react-*
或npm start --reset-cache
.
和我一样的问题。只需删除 yourproject\node_modules\react-navigation\src\views\Header.js
中的 12 行代码( import ReactComponentWithPureRenderMixin
但在 react 中不存在且从未使用过)就可以了。