开发服务器返回了响应错误代码:500本机响应

时间:2018-12-08 14:13:09

标签: javascript reactjs react-native react-redux

我只是尝试在ubuntu上使用android运行react-native app.。现在,我在这里使用了react-native init。 在这里,我刚刚创建了一个项目,并尝试使用命令

react-native run-android

此后,我在模拟器上遇到错误,

开发服务器返回响应错误代码:500

URL: http://Ip:8081/index.delta?platform=android&dev=true&minify=false

Body:
{"type":"TransformError","lineNumber":0,"errors":[{"description":"/home//ProjectWork/native/AwesomeProject/index.js: Couldn't find preset \"module:metro-react-native-babel-preset\" relative to directory \"/home//ProjectWork/native/AwesomeProject\"","lineNumber":0}],"name":"SyntaxError","message":"/home//ProjectWork/native/AwesomeProject/index.js: Couldn't find preset \"module:metro-react-native-babel-preset\" relative to directory \"/home//ProjectWork/native/AwesomeProject\"","stack":"Error: Couldn't find preset \"module:metro-react-native-babel-preset\" relative to directory \"/home//ProjectWork/native/AwesomeProject\"\n    at /home//ProjectWork/native/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19\n    at Array.map (native)\n    at OptionManager.resolvePresets (/home//ProjectWork/native/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)\n    at OptionManager.mergePresets (/home//ProjectWork/native/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)\n    at OptionManager.mergeOptions (/home//ProjectWork/native/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)\n    at OptionManager.init (/home//ProjectWork/native/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)\n    at File.initOptions (/home//ProjectWork/native/AwesomeProject/node_modules/babel-core/lib/transformation/file/index.js:212:65)\n    at new File (/home//ProjectWork/native/AwesomeProject/node_modules/babel-core/lib/transformation/file/index.js:135:24)\n    at Pipeline.transform (/home//ProjectWork/native/AwesomeProject/node_modules/babel-core/lib/transformation/pipeline.js:46:16)"}
processBundleResult
    BundleDownloader.java:266
access$200
    BundleDownloader.java:35
onResponse
    BundleDownloader.java:153
execute
    RealCall.java:135
run
    NamedRunnable.java:32
runWorker
    ThreadPoolExecutor.java:1162
run
    ThreadPoolExecutor.java:636
run
    Thread.java:764

所以,我不明白这个错误。

我的package.json

{
  "name": "AwesomeProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "android": "react-native run-android"
  },
  "dependencies": {
    "react": "16.6.1",
    "react-native": "0.55.4"
  },
  "devDependencies": {
    "babel-jest": "23.6.0",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "0.50.0",
    "react-test-renderer": "16.6.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

我的.bablerc

{
  "presets": ["module:metro-react-native-babel-preset"]
}

有人可以帮助我解决这个问题吗?

0 个答案:

没有答案