简体   繁体   English

无法为 react-native 加载带有 aws-sdk 的捆绑包

[英]Failed to load bundle with aws-sdk for react-native

After installing aws-sdk for react native and adding:在安装 aws-sdk for react native 并添加:

var AWS = require('aws-sdk/dist/aws-sdk-react-native');

to one of the screens, my app bundle loads up to 99%, freezes and then I get the following error:在其中一个屏幕上,我的应用程序包加载高达 99%,冻结,然后我收到以下错误:

Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(Could not connect to development server.

Ensure the following:
- Node server is running and available on the same network - run 'npm start' from react-native root
- Node server URL is correctly set in AppDelegate
- WiFi is enabled and connected to the same network as the Node Server

... ...

also this error message appears in my Xcode terminal:此错误消息也出现在我的 Xcode 终端中:

Call retries were exceeded aws react native

How to fix this bug?如何修复这个错误?

from my package.json:来自我的 package.json:

    "dependencies": {
        ...
        "amazon-kinesis-video-streams-webrtc": "^1.0.8",
        "aws-sdk": "^2.689.0",
        "events": "^3.1.0",
        "react": "16.11.0",
        "react-native": "0.62.2",
         ...
      },

I found this thread discussing 'failed to load bundle' error with aws-sdk.我发现这个线程讨论了 aws-sdk 的“加载包失败”错误。 This comment helped me fix this issue: 这条评论帮助我解决了这个问题:

I fixed this memory issue in my project with below steps.我通过以下步骤在我的项目中修复了这个 memory 问题。 React-Native: 0.60.5 aws-sdk: 2.398.0 React-Native:0.60.5 aws-sdk:2.398.0

In your package.json add below line in a scripts, "start-max": "node --max-old-space-size=8192 node_modules/react-native/local-cli/cli.js start"在您的 package.json 在脚本中添加以下行,“start-max”:“node --max-old-space-size=8192 node_modules/react-native/local-cli/cli.js start”

Restart your npm with below command npm run start-max使用以下命令重新启动您的 npm npm run start-max

In my case max-old-space-size=8192 was not enough.在我的情况下 max-old-space-size=8192 是不够的。 I bumped it up to 1600:我把它提高到1600:

"scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "start-max": "node --max-old-space-size=16000 node_modules/react-native/local-cli/cli.js start"
  },

I don't know how hacky/stable this fix is but now I can load the app bundle on my iOS device.我不知道这个修复程序有多复杂/稳定,但现在我可以在我的 iOS 设备上加载应用程序包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM