升级到0.57.1​​时反应不佳

时间:2018-10-03 09:41:17

标签: reactjs react-native babel

im将我的react native项目从0.54.6升级到0.57.1​​,并在我的pckager中给出此错误

这是我的package.json

Loading dependency graph, done.
error: bundling failed: Error: The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean. If you are migrating from Babylon/Babel 6 or want to use the old decorators proposal, you should use the 'decorators-legacy' plugin instead of 'decorators'.
    at validatePlugins (C:\Users\pimi-laptop\Desktop\project\upgrade\project\node_modules\@babel\parser\lib\index.js:10424:13)    at getParser (C:\Users\pimi-laptop\Desktop\project upgrade\project\node_modules\@babel\parser\lib\index.js:10481:5)
    at parse (C:\Users\pimi-laptop\Desktop\project upgrade\project\node_modules\@babel\parser\lib\index.js:10452:20)
    at parser (C:\Users\pimi-laptop\Desktop\projectupgrade\project\node_modules\@babel\core\lib\transformation\normalize-file.js:170:34)
    at normalizeFile (C:\Users\pimi-laptop\Desktop\project upgrade\project\node_modules\@babel\core\lib\transformation\normalize-file.js:138:11)
    at runSync (C:\Users\pimi-laptop\Desktop\project upgrade\project\node_modules\@babel\core\lib\transformation\index.js:44:43)
    at transformSync (C:\Users\pimi-laptop\Desktop\project upgrade\project\node_modules\@babel\core\lib\transform.js:43:38)
    at Object.transform (C:\Users\pimi-laptop\Desktop\project upgrade\project\node_modules\react-native\node_modules\metro\src\reactNativeTransformer.js:153:5)
    at C:\Users\pimi-laptop\Desktop\project upgrade\project\node_modules\metro-config\node_modules\metro\src\JSTransformer\worker.js:182:23
 BUNDLE  [android, dev] ..\..\../index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.

::ffff:127.0.0.1 - - [03/Oct/2018:08:30:05 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.10.0"

这是我的.babelrc外观

{
  "name": "project",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    ...
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "react": "16.0.0-beta.5",
    "react-native": "^0.55.4",
    ...
  },
  "devDependencies": {
    "babel-jest": "21.2.0",
    "babel-preset-react-native": "^4.0.0",
    "jest": "21.2.1",
    "react-test-renderer": "16.0.0-beta.5",
    "redux-logger": "^3.0.6"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./assets/fonts/"
    ]
  }
}

我尝试安装最新版本的babel,但我不确定那是否可行或我是否正确

我的项目成功构建,但是我的打包程序没有加载到最后,并因该错误而卡住

感谢前进。

0 个答案:

没有答案