代码之家  ›  专栏  ›  技术社区  ›  kemicofa ghost

未处理的JS异常:意外的标识符“_object$defineproperty”。import只需要一个参数

  •  -1
  • kemicofa ghost  · 技术社区  · 6 年前

    在使用各种工具清理项目之后,我消除了另一个错误,它导致项目在构建过程中失败。( react-native run-ios

    yarn upgrade
    yarn cache clean
    react-native upgrade
    rm -rf ios/build/; kill $(lsof -t -i:8081); react-native run-ios
    

    https://github.com/babel/babel-loader/issues/195

    为什么我得到一个模糊的错误说我有一个未处理的JS异常?

    {
      "presets": ["react-native"],
      "plugins": ["transform-decorators-legacy",
        "transform-async-generator-functions",
        "transform-object-rest-spread",
        "transform-class-properties",
        "transform-regenerator"]
    }
    

    react-native info

    Environment:
      OS: macOS High Sierra 10.13.5
      Node: 9.5.0
      Yarn: 1.6.0
      npm: 5.6.0
      Watchman: 4.9.0
      Xcode: Xcode 9.4.1 Build version 9F2000
      Android Studio: 3.1 AI-173.4670197
    
    Packages: (wanted => installed)
      react: ^16.3.0-alpha.1 => 16.4.1
      react-native: 0.54.4 => 0.54.4
    

    {
      "name": "FluxRN",
      "version": "0.0.1",
      "private": true,
      "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
      },
      "dependencies": {
        "mobx": "^5.0.2",
        "mobx-react": "^5.2.3",
        "moment": "^2.22.0",
        "native-base": "^2.5.2",
        "react": "^16.3.0-alpha.1",
        "react-native": "0.54.4",
        "react-native-vector-icons": "^4.6.0",
        "react-navigation": "^1.5.9"
      },
      "devDependencies": {
        "babel-jest": "22.4.3",
        "babel-plugin-transform-async-generator-functions": "^6.24.1",
        "babel-plugin-transform-class-properties": "^6.24.1",
        "babel-plugin-transform-decorators": "^6.24.1",
        "babel-plugin-transform-decorators-legacy": "^1.3.5",
        "babel-plugin-transform-object-rest-spread": "^6.26.0",
        "babel-plugin-transform-regenerator": "^6.26.0",
        "babel-plugin-transform-runtime": "^6.23.0",
        "babel-preset-react-native": "4.0.0",
        "jest": "22.4.3",
        "react-test-renderer": "^16.3.0-alpha.1"
      },
      "jest": {
        "preset": "react-native"
      }
    }
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   kemicofa ghost    6 年前

    {
      "name": "FluxRN",
      "version": "0.0.1",
      "private": true,
      "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
      },
      "dependencies": {
        "moment": "^2.22.0",
        "native-base": "^2.5.2",
        "react": "^16.3.1",
        "react-native": "0.55.4",
        "react-native-vector-icons": "^4.6.0",
        "react-navigation": "^1.5.9"
      },
      "devDependencies": {
        "babel-jest": "23.0.1",
        "babel-preset-react-native": "4.0.0",
        "jest": "23.1.0",
        "react-test-renderer": "^16.3.1"
      },
      "jest": {
        "preset": "react-native"
      }
    }