`react-native init AwesomeProject` throwing SyntaxError

后端 未结 3 446
情话喂你
情话喂你 2021-01-21 22:30

react-native init AwesomeProject is throwing SyntaxError: Unexpected token : and I\'m not sure why. I\'ve uninstalled and re-installed react-native-cli

相关标签:
3条回答
  • 2021-01-21 22:45

    Apparently the new version React Native 0.56.0 has this problem.

    To fix this problem, you can install the previous version.

    react-native init --version="0.55.0" MyNewApp
    
    0 讨论(0)
  • 2021-01-21 22:53

    Update node version on OS.

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n stable
    
    0 讨论(0)
  • 2021-01-21 23:06

    Looks like the error an update was published to react-native. Others are experiencing the same issue so I'm going to answer this and say it's a package issue. https://github.com/facebook/react-native/issues/11384


    Until this gets resolved, you can use rninit(https://www.npmjs.com/package/rninit) to install using the previous version of react-native. This worked for me:
    rninit init mobile --source react-native@0.39.0

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