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

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 使用遇到的常见问题(持续更新))