这个问题我已经尝试解决了一段时间。我的React本机应用程序在IOS上运行良好,完全没有问题。现在,我正在尝试使其在Android上运行,并且一直遇到问题。
运行命令时-react-native run-android
这是我的.babelrc
文件
{
"presets": ["@babel/preset-env"],
"env": {
"production": {
"plugins": ["ignite-ignore-reactotron"]
}
}
}
这是我的package.json
文件
{
"name": "QRSelf",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force",
"clean:android": "cd android/ && ./gradlew clean && cd .. && react-native run-android",
"newclear": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean --force && npm i",
"test:watch": "jest --watch",
"updateSnapshot": "jest --updateSnapshot",
"coverage": "jest --coverage && open coverage/lcov-report/index.html || xdg-open coverage/lcov-report/index.html",
"android:build": "cd android && ./gradlew assembleRelease",
"android:install": "cd android && ./gradlew assembleRelease && ./gradlew installRelease",
"android:hockeyapp": "cd android && ./gradlew assembleRelease && puck -submit=auto app/build/outputs/apk/app-release.apk",
"android:devices": "$ANDROID_HOME/platform-tools/adb devices",
"android:logcat": "$ANDROID_HOME/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V",
"android:shake": "$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82",
"storybook": "storybook start -p 7007"
},
"dependencies": {
"@babel/runtime": "^7.3.4",
"apisauce": "^0.14.2",
"form-data": "^2.3.3",
"format-json": "^1.0.3",
"identity-obj-proxy": "^3.0.0",
"lodash": "^4.17.4",
"native-base": "^2.8.0",
"prop-types": "^15.6.1",
"querystringify": "1.0.0",
"ramda": "^0.25.0",
"react": "16.3.1",
"react-native": "^0.58.3",
"react-native-camera": "^1.2.0",
"react-native-config": "^0.10.0",
"react-native-keyboard-aware-scroll-view": "^0.8.0",
"react-native-qrcode-scanner": "^1.1.0",
"react-native-text-input-mask": "^0.8.0",
"react-native-torch": "^1.1.5",
"react-navigation": "^1.5.11",
"react-navigation-redux-helpers": "^1.0.4",
"react-navigation-transitions": "^1.0.6",
"react-number-format": "^4.0.6",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-saga": "^0.16.0",
"reduxsauce": "0.7.0",
"seamless-immutable": "^7.1.2"
},
"devDependencies": {
"@babel/preset-env": "^7.3.4",
"@storybook/addon-storyshots": "^3.4.0",
"@storybook/addons": "^3.4.0",
"@storybook/channels": "^3.4.0",
"@storybook/react-native": "^3.4.0",
"babel-core": "6.26.0",
"babel-jest": "23.6.0",
"babel-plugin-ignite-ignore-reactotron": "^0.3.0",
"babel-plugin-transform-es2015-block-scoping": "^6.26.0",
"babel-preset-env": "^2.0.0-alpha.20",
"babel-preset-react-native": "^2.1.0",
"enzyme": "^3.2.0",
"enzyme-adapter-react-16": "^1.1.0",
"husky": "^0.14.3",
"ignite-ir-boilerplate-andross": "^2.3.3",
"jest": "23.6.0",
"mockery": "^2.1.0",
"react-dom": "16.3.0",
"react-test-renderer": "16.3.1",
"reactotron-react-native": "^2.0.0-alpha.3",
"reactotron-redux": "^2.0.0-alpha.3",
"reactotron-redux-saga": "^2.0.0-alpha.3"
},
"jest": {
"testMatch": [
"<rootDir>/Tests/**/*.js",
"**/?(*.)(spec|test).js?(x)"
],
"testPathIgnorePatterns": [
"/node_modules/",
"<rootDir>/Tests/Setup.js"
],
"moduleNameMapper": {
"^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "identity-obj-proxy"
},
"setupFiles": [
"<rootDir>/Tests/Setup"
],
"preset": "react-native"
},
"config": {}
}
以下是错误:
Loading dependency graph, done.
error: bundling failed: TypeError: Cannot read property 'bindings' of null
at Scope.moveBindingTo (/Users/matthewruddy/Desktop/qr/node_modules/@babel/traverse/lib/scope/index.js:866:13)
at BlockScoping.updateScopeInfo (/Users/matthewruddy/Desktop/qr/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:364:17)
at BlockScoping.run (/Users/matthewruddy/Desktop/qr/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:330:12)
at PluginPass.BlockStatementSwitchStatementProgram (/Users/matthewruddy/Desktop/qr/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:70:24)
at newFn (/Users/matthewruddy/Desktop/qr/node_modules/@babel/traverse/lib/visitors.js:193:21)
at NodePath._call (/Users/matthewruddy/Desktop/qr/node_modules/@babel/traverse/lib/path/context.js:53:20)
at NodePath.call (/Users/matthewruddy/Desktop/qr/node_modules/@babel/traverse/lib/path/context.js:40:17)
at NodePath.visit (/Users/matthewruddy/Desktop/qr/node_modules/@babel/traverse/lib/path/context.js:88:12)
at TraversalContext.visitQueue (/Users/matthewruddy/Desktop/qr/node_modules/@babel/traverse/lib/context.js:118:16)
请帮助!