# NPM build fails with heap size issue

**URL:** <https://devforum.zoom.us/t/npm-build-fails-with-heap-size-issue/73623>\
**Category:** Video SDK\
**Created:** [August 4, 2022, 10:30am UTC](https://devforum.zoom.us/t/npm-build-fails-with-heap-size-issue/73623 "2022-08-04T10:30:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gourishmesta1993](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gourishmesta1993/32/39300_2.png) [@gourishmesta1993](https://devforum.zoom.us/u/gourishmesta1993)\
**Post date:** [August 4, 2022, 10:30am UTC](https://devforum.zoom.us/t/npm-build-fails-with-heap-size-issue/73623/1 "2022-08-04T10:30:18Z")

</div>

**Video SDK Type and Version**  
“@zoom1234/videosdk”: “^1.4.0”

**Platform**  
React js

**Description**  
On importing the videosdk npm build fails

```auto
import ZoomVideo from "@zoom/videosdk";

```

**Error?**

```auto
Creating an optimized production build...
         
         <--- Last few GCs --->
         
         [5448:03B2AF30] 187840 ms: Mark-sweep (reduce) 1020.0 (1028.1) -> 1019.6 (1028.6) MB, 1527.3 / 0.0 ms (average mu = 0.141, current mu = 0.005) allocation failure scavenge might not succeed
         [5448:03B2AF30] 189706 ms: Mark-sweep (reduce) 1020.8 (1028.8) -> 1020.7 (1029.6) MB, 1858.1 / 0.0 ms (average mu = 0.076, current mu = 0.004) allocation failure scavenge might not succeed
         
         
         <--- JS stacktrace --->
         
     6>EXEC : FATAL error : MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory [D:\j3\workspace\Innovia_Dev\InnoviaClient\InnoviaClient.csproj]
         npm ERR! code ELIFECYCLE
         npm ERR! errno 134
         npm ERR! InnoviaWeb@0.1.0 build: `react-scripts build`
         npm ERR! Exit status 134
         npm ERR! 
         npm ERR! Failed at the InnoviaWeb@0.1.0 build script.
         npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
         
         npm ERR! A complete log of this run can be found in:
         npm ERR! C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_logs\2022-08-04T10_21_28_108Z-debug.log

```

**How To Reproduce**  
_Steps to reproduce the behavior including:_  
_1. Install latest zoom video sdk version_  
\*2. import in a component/page  
\*3. npm run build

I tried removing the sdk and runing the build command it worked but as soon as i add the import statement for zoom video sddk build fails

Anyone facing this issue?

Thank You  
Gourish

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [August 10, 2022, 2:52am UTC](https://devforum.zoom.us/t/npm-build-fails-with-heap-size-issue/73623/2 "2022-08-10T02:52:13Z")

</div>

> [@gourishmesta1993](#):
>
> `JavaScript heap out of memory `

Hi @gourishmesta1993 , try either of these suggestions:

- [How to resolve the memory heap out issue in React App](https://help.boldreports.com/embedded-reporting/react-reporting/how-to/how-to-resolve-the-javascript-memory-heap-out-issue/#:~:text=The%20memory%20heap%20out%20issue%20occurs%20when%20the%20heap%20size,in%20the%20below%20code%20snippet).
- [How to solve JavaScript heap out of memory error | sebhastian](https://sebhastian.com/javascript-heap-out-of-memory/)

Let us know if it helps and any other troubleshooting efforts you try.

Best,  
Gianni

---

<div class="post-metadata">

**Author:** ![gourishmesta1993](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gourishmesta1993/32/39300_2.png) [@gourishmesta1993](https://devforum.zoom.us/u/gourishmesta1993)\
**Post date:** [August 10, 2022, 9:35am UTC](https://devforum.zoom.us/t/npm-build-fails-with-heap-size-issue/73623/3 "2022-08-10T09:35:13Z")

</div>

@gianni.zoom

tried both the solutions still same error.

Even tried adding --max\_old\_space\_size=5120

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/8/0/8067c24be5651e3de6606a0744db14c661f11023.png)

Thank You

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [August 10, 2022, 3:59pm UTC](https://devforum.zoom.us/t/npm-build-fails-with-heap-size-issue/73623/4 "2022-08-10T15:59:34Z")

</div>

Hi @gourishmesta1993 , this error is generic and requires quite a bit of troubleshooting to find the right fix for your configuration.

I’ve seen some suggestions about modifying your package.json: [node.js - How to fix "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory" error - Stack Overflow](https://stackoverflow.com/questions/55613789/how-to-fix-fatal-error-ineffective-mark-compacts-near-heap-limit-allocation-fa)

This is for AWS, but could still be helpful: ['JavaScript heap out of memory' when adding a dependency on the SDK to a small react-native app · Issue #1877 · aws/aws-sdk-js · GitHub](https://github.com/aws/aws-sdk-js/issues/1877)

Because this issue is not specific to our video SDK, I recommend continuing to use various developer resources like the ones I’ve shared to fix.

Please update us when you resolve 🙂

---

<div class="post-metadata">

**Author:** ![gourishmesta1993](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gourishmesta1993/32/39300_2.png) [@gourishmesta1993](https://devforum.zoom.us/u/gourishmesta1993)\
**Post date:** [August 11, 2022, 11:07am UTC](https://devforum.zoom.us/t/npm-build-fails-with-heap-size-issue/73623/5 "2022-08-11T11:07:32Z")

</div>

Hi @gianni.zoom

Issue is no more occurring now. 😇

First i executed the below command

```auto
set NODE_OPTIONS=--max_old_space_size=7168

```

Then i added the below code  
`"start": "react-scripts --max_old_space_size=7168 start",`  
`"build": "react-scripts --max_old_space_size=7168 build",`

this fixed the issue and right the build is getting created .

Thank You

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [August 11, 2022, 4:46pm UTC](https://devforum.zoom.us/t/npm-build-fails-with-heap-size-issue/73623/6 "2022-08-11T16:46:00Z")

</div>

@gourishmesta1993 ,

Nice I’m so happy it’s been resolved and thank you for sharing exactly what you did!
