在构建Android应用时出现React Native错误

时间:2018-07-07 16:05:43

标签: react-native

构建Android应用程序时出现以下错误。谁能解释为什么会发生

    import type {CommandT} from './commands';
       ^^^^

SyntaxError: Unexpected identifier
    at new Script (vm.js:74:7)
    at createScript (vm.js:246:10)
    at Object.runInThisContext (vm.js:298:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Module._compile (E:\React_Project\OneTap\node_modules\pirates\lib\index.js:91:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.newLoader [as .js] (E:\React_Project\OneTap\node_modules\pirates\lib\index.js:96:7)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! OneTap@0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the OneTap@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

1 个答案:

答案 0 :(得分:1)

基于此GitHub Issue,看来这是Windows中与RN 0.56相关的问题。作为一种解决方法,我建议使用版本0.55.4。