TransformError with babel-preset-react-native/index.js

前端 未结 3 417
慢半拍i
慢半拍i 2020-12-16 04:36

I\'m brand new to react-native, and trying to render my first bit of text on the screen.

When I run react-native run-ios and then click into my sample a

相关标签:
3条回答
  • 2020-12-16 04:43

    I got same problem yesterday and my way is:

    1. Go to node_modules and remove babel-preset-react-native folder.
    2. In root project type:
      npm install babel-preset-react-native@2.1.0 --save-dev

    Hope you get this solved.

    Thanks GaBACK

    0 讨论(0)
  • 2020-12-16 04:59

    This is bug in the new version of babel-preset-react-native as it will added automatically after you run react-native init command

    Please take a look at this github issue https://github.com/facebook/react-native/issues/15513

    Workaround, try to change the version:

    yarn remove babel-preset-react-native
    yarn add babel-preset-react-native@2.1.0
    

    if that's not work for you, try to remove trailing comma at node_modules/babel-preset-react-native/configs/main.js at this code below

    https://github.com/facebook/react-native/blob/6ad7e8281b37ee2ce6425363c0b17420d056807a/babel-preset/configs/main.js#L40 and re-run your app

    0 讨论(0)
  • 2020-12-16 05:00

    I got same problem yesterday and my way is:
    1. Go to node_modules and remove babel-preset-react-native folder.
    2. In root project type: npm install babel-preset-react-native@2.1.0 --save-dev

    Hope you get this solved.

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