react-navigation找不到

React-Native 今天学习导航栏react-navigation的时候,遇到一个坑,后来找到一个大神帮忙解决,之前百度了很久一直没有找到解决办法,为了避免更多的人踩坑,决定写点东西,

先贴错误日志:

ComponentWithPureRenderMixin` from `D:\rnworkspace\SimpleApp\node_modules\react-

navigation\src\views\Header.js`: Module does not exist in the module map or in t

hese directories:

D:\rnworkspace\SimpleApp\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 p.catch.error (D:/rnworkspace/SimpleApp/node_modules/react-native/package

r/src/node-haste/DependencyGraph/ResolutionRequest.js:366:19)

at process._tickCallback (internal/process/next_tick.js:109:7)

Bundling `index.android.js`  6.3% (1/4), failed.

界面上则是这么显示的:the development server returned response error code 500

我个人也是按照官网 https://reactnavigation.org/docs/intro/ 的办法操作的,就会出这样的问题

最后的解决办法是 先卸载这个react-navigation,命令是npm uninstall react-navigation

然后在重新安装 npm install -save https://github.com/react-community/react-navigation

最后就可以了,如果有帮到你,请帮忙点个赞,让更多人看到!

推荐阅读更多精彩内容