1.Error log:
E:\project\my\scanner-qrcode-master\node_modules\metro-config\src\defaults\blacklist.js:38
return new RegExp(
^
SyntaxError: Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class
at new RegExp (<anonymous>)
at blacklist (E:\project\my\react-native-scanner-qrcode-master\node_modules\metro-config\src\defaults\blacklist.js:38:10)
at getBlacklistRE (E:\project\my\react-native-scanner-qrcode-master\node_modules\react-native\local-cli\util\Config.js:58:10)
at Object.<anonymous> (E:\project\my\react-native-scanner-qrcode-master\node_modules\react-native\local-cli\util\Config.js:73:20)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Module._compile (E:\project\my\react-native-scanner-qrcode-master\node_modules\pirates\lib\index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Object.newLoader [as .js] (E:\project\my\react-native-scanner-qrcode-master\node_modules\pirates\lib\index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
解决方法:
进入node_modules\metro-config\src\defaults 编辑 blacklist.js
/node_modules[/\\]react[/\\]dist[/\\].*/ 修改为 /node_modules[\/\\]react[\/\\]dist[\/\\].*/
2. react native 错误unable to load script form assets解决
1.首先手动在 项目名\android\app\src\main 下建立一个assets文件夹
2.然后cmd 进入项目的根目录下执行 react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
3.在执行 react-native run-android 跑起来了
问题1:
E:\project\my\JasperMobile>adb advices
adb.exe: unknown command advices
解决方法:
adb nodaemon server
netstat -ano | findstr "5037"
如果pid为12260 则它占用了5037端口
tasklist | findstr "13580"
taskkill /f /pid 13580