react-native 初始化 各种报错 及 解决方案

1.Unable to load script from assets 'index.android.bundle'.

curl -k "http://localhost:8081/index.android.bundle" > android/app/src/main/assets/index.android.bundle

2.error: bundling failed: Error: Unable to resolve module 'AccessibilityInfo' from

降级处理

react-native init AwesomeProject
cd AwesomeProject
react-native run-android
npm uninstall react-native
npm install --save [email protected]
react-native run-android
npm install --save babel-core@latest babel-loader@latest
npm uninstall --save-dev babel-preset-react-native
npm install --save-dev [email protected]
react-native run-android

3.UnableToResolveError: Unable to resolve module ‘***’

这个问题很常见,原则上是任何npm依赖包都有可能发现这个问题,介绍下解决方案吧

step one: rm -r node_modules
step two: npm cache clean --force
step three: npm install 
step four: npm start -- --reset-cache

一般step one, step three, step four就可以解决问题

猜你喜欢

转载自www.cnblogs.com/crazycode2/p/9334084.html