[新手提问前先来这里看看]React Native的常见问题
npm包管理错误
Unable to resolve module react/lib/ReactUpdates from /Users/user/Downloads/react-native-sudoku-master/node_modules/react-native/Libraries/react-native/react-native.js: Module does not exist in the module map or in these directories:
/Users/user/Downloads/react-native-sudoku-master/node_modules/react-native/node_modules/react/lib
, /Users/user/Downloads/react-native-sudoku-master/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`.
RCTFatal + 104
-[RCTBatchedBridge stopLoadingWithError:] + 1138
__25-[RCTBatchedBridge start]_block_invoke_2 + 65
_dispatch_call_block_and_release + 12
_dispatch_client_callout + 8
_dispatch_main_queue_callback_4CF + 1054
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
__CFRunLoopRun + 2205
CFRunLoopRunSpecific + 420
GSEventRunModal + 161
UIApplicationMain + 159
main + 111
start + 1
上面这个错误stackoverflow和github的issue都有很多方法,但是找了很久没有能解决我问题的,后来各种删除node_modules然后npm install ,npm update,npm cache clean都不能解决问题
stackoverflow解决方法
后来发现,每次intall完都有一个WARN,提示react没有install
然后又修改了package.json的react版本美号,各种单独install react,再update,后来成功了
好像是因为包依赖的问题,react一直没有下下来,是网络问题?
Paste_Image.png
网友评论
我遭遇的问题是项目里package.josn里react版本是16.0.0 但是官方repo里面要求16.2.0
yarn add react@16.2.0
就好了