美文网首页
React Native 使用遇到的常见问题(持续更新)

React Native 使用遇到的常见问题(持续更新)

作者: Jason_兵哥 | 来源:发表于2018-07-05 14:57 被阅读27次

    1. react-native init proj_name初始项目时报错,

    具体信息

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

    ^^^^^^

    SyntaxError: Unexpected token import

        at createScript (vm.js:80:10)

        at Object.runInThisContext (vm.js:139:10)

        at Module._compile (module.js:607:28)

        at Module._compile (D:\Reactnative\Project\Learnwizz\node_modules\pirates\lib\index.js:91:24)

        at Module._extensions..js (module.js:654:10)

        at Object.newLoader [as .js] (D:\Reactnative\Project\Learnwizz\node_modules\pirates\lib\index.js:96:7)

        at Module.load (module.js:556:32)

        at tryModuleLoad (module.js:499:12)

        at Function.Module._load (module.js:491:3)

        at Module.require (module.js:587:17)

    原因: "react-native": "0.56.0", 发现package.json里初始出版本是0.56,找到解决办法是用以前的版本:

    react-native init --version="0.55.4" projectName

    问题解决 (参考地址:

    https://stackoverflow.com/questions/51178688/error-creating-new-react-native-project/51180936

    )

    2. ...

    相关文章

      网友评论

          本文标题:React Native 使用遇到的常见问题(持续更新)

          本文链接:https://www.haomeiwen.com/subject/hndpuftx.html