react-native 爬坑

 

最近学习react native时出现一些问题为方便自己,同时造福后来者,特此记录

运行react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/asset
s/index.android.bundle --assets-dest android/app/src/main/res

时出现以下问题

Unable to resolve module `AccessibilityInfo` from `D:\react-native\Newbie\node_modules\react-native\Libraries\react-native\react-native-im
plementation.js`: Module `AccessibilityInfo` does not exist in the Haste module map

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 Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.  4. Remove haste cache: `rm -rf /tmp/
haste-map-react-native-packager-*`.

 

找了半天解决办法

1:进入cmd

2:运行以下命令

npm uninstall -g react-native-cli

3:安装

npm install [email protected]

4:安装

npm install -g [email protected]

5:初始化工程

react-native init --version="0.55.4" +'工程名'

你可能感兴趣的:(react-native,android开发)