can't create project using react-native init

后端 未结 2 1187
暖寄归人
暖寄归人 2020-12-21 22:21

I am getting this error again and again when creating a new project using react-native init. I reinstalled react-native cli and tried again but no luck. Can someone please t

相关标签:
2条回答
  • 2020-12-21 23:05

    This error is may be because of react native version React native 0.56

    Here is the link about the discussion of this issue React native 0.56.* - "Unexpected identifier"

    So they suggest us to downgrade the version of react-native React Native Version List

    So open the file of your project named as package.json

    inside it you can find react-native": "0.56.4" replace this version with react-native": "0.55.4" or what ever the version you want

    then save the file

    go to the terminal or power sell

    rich to the your project directory and run the command npm-install

    after installation check the version of react-native by running the command react-native --version and make sure that version is which you changed in package.json

    restart your project and you are ready to go without this error

    0 讨论(0)
  • 2020-12-21 23:05

    This problem can be resolve in one line code nothing more

    $ react-native init [projectName] --version react-native@0.55.4

    what this does is that you explicitly tell that you want your project to be created with this specify version

    0 讨论(0)
提交回复
热议问题