代码之家  ›  专栏  ›  技术社区  ›  Moyote

React Native v0.56:无法读取PluginPass.JSXOpeningElement处未定义的属性“filename”

  •  3
  • Moyote  · 技术社区  · 6 年前

    我刚刚将React Native从0.55更新到0.56。

    但是,当我尝试运行代码(react native run android或run ios)时,绑定到此为止:

    Loading dependency graph, done.
    error: bundling failed: TypeError: Cannot read property 'filename' of undefined
        at PluginPass.JSXOpeningElement ({path_to_my_project}/react-native/node_modules/babel-plugin-transform-react-jsx-source/lib/index.js:32:39) 
    

    这是我的。宝贝:

    {
      "presets": [
        "react-native"
      ],
      "env": {
        "development": {
          "plugins": [
            "transform-react-jsx-source"
          ]
        }
      }
    }
    

    和package.json

    "dependencies": {
        "babel-jest": "23.4.2",
        "babel-preset-react-native": "5.0.2",
        "react": "16.4.1",
        "react-native": "0.56.0",
      }
    

    我已经删除了node_modules文件夹并再次安装了软件包,但没有成功。

    有什么建议吗?任何帮助都将不胜感激!

    1 回复  |  直到 6 年前
        1
  •  24
  •   StackedQ the red crafteryt    5 年前

    我删除了

    "env": {
        "development": {
          "plugins": [
            "transform-react-jsx-source"
          ]
        }
     }
    

    从…巴贝尔和它的工作。

    所以最后我的宝贝看起来

    { “presets”:[“react native”] }