我使用react-native来捆绑Android APK。
我能够在开发模式下正确运行它,但还没有能够释放已签名的apk。
node version: `v5.10.0`
npm version: `3.8.3`
react-native version: `0.22.2`
尝试使用babel核心版本
6.5.1
6.4.5
6.7.4
运行这些命令之一时出现的错误
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/
react-native bundle --platform android --dev true --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
是
bundle: Created ReactPackager uncaught error Error: SyntaxError: /Users/'username'/projects/personal/openchs/openchs-client/node_modules/react-native/Libraries/react-native/react-native.js:
意外的令牌(120:2) //注意:这必须放在最后才能防止急切 //评估上面的getter-wrapped子模块 ...需要('阵营'), };
if (__DEV__) { at Parser.pp.raise (/Users/mihir/projects/personal/openchs/openchs-client/node_modules/babylon/index.js:1378:13) at Parser.pp.unexpected (/Users/mihir/projects/personal/openchs/openchs-client/node_modules/babylon/index.js:2817:8) at Parser.pp.parseIdentifier (/Users/mihir/projects/personal/openchs/openchs-client/node_modules/babylon/index.js:1227:10) at Parser.pp.parsePropertyName (/Users/mihir/projects/personal/openchs/openchs-client/node_modules/babylon/index.js:1070:135) at Parser.pp.parseObj (/Users/mihir/projects/personal/openchs/openchs-client/node_modules/babylon/index.js:986:12) at Parser.pp.parseExprAtom (/Users/mihir/projects/personal/openchs/openchs-client/node_modules/babylon/index.js:718:19) at Parser.parseExprAtom (/Users/mihir/projects/personal/openchs/openchs-client/node_modules/babylon/index.js:4305:22) at Parser.pp.parseExprSubscripts (/Users/mihir/projects/personal/openchs/openchs-client/node_modules/babylon/index.js:504:19) at Parser.pp.parseMaybeUnary (/Users/mihir/projects/personal/openchs/openchs-client/node_modules/babylon/index.js:484:19) at Parser.pp.parseExprOps (/Users/mihir/projects/personal/openchs/openchs-client/node_modules/babylon/index.js:415:19) See logs /var/folders/zj/sk4075x566l8jdl1gwzjl79h0000gn/T/react-packager.log at SocketClient._handleMessage (SocketClient.js:144:23) at BunserBuf.<anonymous> (SocketClient.js:53:42) at emitOne (events.js:90:13) at BunserBuf.emit (events.js:182:7) at BunserBuf.process (/Users/mihir/projects/personal/openchs/openchs-client/node_modules/bser/index.js:289:10) at /Users/mihir/projects/personal/openchs/openchs-client/node_modules/bser/index.js:244:12 at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)
我的更多代码就在这里 - https://github.com/OpenCHS/openchs-client
答案 0 :(得分:0)
任何找到这个并正在寻找答案的人都可以在这里找到:SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
您需要安装babel-preset-react-native-stage-0软件包并将其包含在.babelrc预设数组中