React-Native TransformError



  • 我照着RN官网给的教程一步步地搭建了一个名为AwesomeProject的Hello World项目。

    版本信息:

    操作系统: OSX EI Capitan 10.11.6
    
    node: 6.2.2
    react-native-cli: 1.0.0
    react-native: 0.31.0
    babel: 6.10.1
    babel-core: 6.9.1
    

    报错信息:

    报错信息

    报错信息来看,是babel的问题。

    然后各种Google、各种试 还是老问题

    SOF问答1

    SOF问答2

    package.json:

    {
      "name": "AwesomeProject",
      "version": "0.0.1",
      "private": true,
      "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start"
      },
      "dependencies": {
        "react": "15.2.1",
        "react-native": "0.31.0"
      },
      "devDependencies": {
        "babel-cli": "^6.11.4",
        "babel-preset-es2015": "^6.13.2",
        "babel-preset-react": "^6.11.1",
        "babel-preset-react-native": "^1.9.0"
      }
    }
    
    

    .babelrc:

    {
     "presets": ["es2015","react-native"]
    }
    

    整整折腾了半下午,还是老样子。

    请问问题出在那里?


  • administrators

    去掉devDependecies,去掉.babelrc(没错,你根本不需要这些)
    然后react-native start --reset-cache


登录后回复