-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'JavaScript heap out of memory' when adding a dependency on the SDK to a small react-native app #1877
Comments
Hi @NON-STANDARD |
same problem here. Added that line of code and can't build for release on Android anymore |
@NON-STANDARD and @AllanFly120, we were able to solve this issue. Although the symptom was a memory issue, that does not seem to be the actual root cause. It appears that the AWS file we are importing is already transpiled and can be left out when doing the babel transformation. This can be achieved by adding the following to the package.json of our react native project: "babel": { Without the above, it seems that the packager goes into a loop and no matter how much memory you give node, it's never enough. We got a hint that this could be the issue looking at this post. There are other ways to ignore said file, including adding the above code to the package.json of the aws-sdk itself. @AllanFly120 feel free to address it the way you deem more appropriate. At a minimum it'd be great if a note could be added to the readme for those that use the aws-sdk in a react-native project. |
Hi @eR1011 , I have the same issue like you. When I see your code, I feel like my life is saved. However, I add your code to my package.json in react native app but it is not working. It looks like the babel do not ignore is. Do you have any way to ignore a file in babel. Here is my package.json:
I try this but fail too:
If you have any suggestion, please let me know. I am willing to hear from you |
Hi everyone , I am able to run debug by changing the
In terminal run: "npm run start-max" to start the node server with 8,192 MB. Enjoy! |
I am able to run my simulator when running that "start-max" script, but when I try to upload my app to testflight, I keep getting the out of memory error. --max-old-space-size=8192 does not help. |
Hi @Blutude , run "start-max" is only for debug mode. If you want to release, we have to config more. I write a post on Medium about it. Hope it can help you. React native max-old-space-size Sorry for replying you late |
I had actually seen that post and did try that. But the Xcode build still fails with JavaScript heap out of memory. |
Hi @Blutude , I guess it is because of the version. I fix the issue with: Can you please let me know your version? |
hey @Blutude , how is everything? |
Hi @truongluong1314520, sorry for the late reply. I still have errors. My Xcode version is 10.1, React native is 0.58.6. In build phases --> Bundle React Native code and images when I replace node by 'node --max_old_space_size=8192', it gives me the following error: "Can't find 'node --max_old_space_size=8192' binary to build React Native bundle" Instead, I try it without the quotes and archive the project but I get "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory". |
Hi @Blutude , you can try this one:
Maybe my previous solution is out of date 😞 |
I have been dealing with this issue for about 20 hours after reading about one hundred different posts. Seeing so many suggestions without examples or any guidance on where to insert scripts (cli / package.json / babel folders / node_module). PLEASE BE MORE SPECIFIC. :)))......>=// For my specific issue, I am received the following heap allocation error for a react-native project created via expo-cli which includes aws packages. package.json: app.json "expo": { Error: |
I'm trying to use this SDK in a create-react-app but the build fails with an out of memory error (see below). The root cause is because I want to authenticate my app I'm using an Amazon profile. The API to perform an Amazon profile authentication is SharedIniFileCredentials which is ONLY available on the root AWS class imported by Could you please consider extending the API of the client classes so that they can be used without a dependency on the root class?
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Adding a dependency on the aws-sdk-js to a small react-native app causes react-native bundler to crash with 'JavaScript heap out of memory':
Added this line (per the README.MD) to my app.js (no other code changed):
var AWS = require('aws-sdk/dist/aws-sdk-react-native');
Results in the following when launching my app:
┌────────────────────────────────────────────────────────────────────────────┐
│ Running Metro Bundler on port 8081. │
│ │
│ Keep Metro Bundler running while developing on any JS projects. Feel │
│ free to close this tab and run your own Metro Bundler instance if you │
│ prefer. │
│ │
│ https://github.com/facebook/react-native │
│ │
└────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
D:\Proj
Metro Bundler ready.
Loading dependency graph, done.
transform[stderr]: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
transform[stderr]: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
transform[stderr]: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
Bundling
index.js
[development, non-minified] 99.6% (556/557), failed.error: bundling failed: Error: Uncaught error in the transformer worker: D:\Proj\node_modules\metro-bundler\src\transformer.js
at _transform.then.catch.error (D:\Proj\node_modules\metro-bundler\src\JSTransformer\index.js:191:31)
at process._tickCallback (internal/process/next_tick.js:109:7)
The text was updated successfully, but these errors were encountered: