# Npm ERR! Maximum call stack size exceeded

**URL:** <https://forums.docker.com/t/npm-err-maximum-call-stack-size-exceeded/100536>\
**Category:** General\
**Tags:** docker, build\
**Created:** [November 10, 2020, 6:50pm UTC](https://forums.docker.com/t/npm-err-maximum-call-stack-size-exceeded/100536 "2020-11-10T18:50:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jverat](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jverat](https://forums.docker.com/u/jverat)\
**Post date:** [November 10, 2020, 6:50pm UTC](https://forums.docker.com/t/npm-err-maximum-call-stack-size-exceeded/100536/1 "2020-11-10T18:50:44Z")

</div>

I’m using Ubuntu 20.04 running on WSL 2 Windows 10 Home build 2004 x64

Docker 19.03.13

## I’m trying to run a hello world node application and when I try to install the dependencies (express) I get this:

> [3/3] RUN npm install:  
> #7 7.285 npm notice  
> #7 7.285 npm notice New patch version of npm available! 7.0.8 → 7.0.9  
> #7 7.286 npm notice Changelog: [https://github.com/npm/cli/releases/tag/v7.0.9](https://github.com/npm/cli/releases/tag/v7.0.9)  
> #7 7.286 npm notice Run `npm install -g npm@7.0.9` to update!  
> #7 7.286 npm notice  
> #7 7.299 npm ERR! Maximum call stack size exceeded  
> #7 7.432  
> #7 7.432 npm ERR! A complete log of this run can be found in:  
> #7 7.433 npm ERR! /root/.npm/\_logs/2020-11-10T18\_46\_56\_236Z-debug.log  
> failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c npm install]: runc did not terminate sucessfully

* * *

Here’s is my Dockerfile

```
FROM node

COPY ./ ./

RUN npm install

CMD ["npm", "start"]

```

---

<div class="post-metadata">

**Author:** ![warnerjonn](https://avatars.discourse-cdn.com/v4/letter/w/eb8c5e/32.png) [@warnerjonn](https://forums.docker.com/u/warnerjonn)\
**Post date:** [February 9, 2021, 6:36am UTC](https://forums.docker.com/t/npm-err-maximum-call-stack-size-exceeded/100536/2 "2021-02-09T06:36:35Z")

</div>

This error is almost always means you have a problem with recursion in JavaScript code, as there isn’t any other way in JavaScript to consume lots of stack. Sometimes calling a recursive function over and over again, causes the browser to send you Maximum [call stack size exceeded](http://net-informations.com/js/err/range.htm) error message as the memory that can be allocated for your use is not unlimited.

How to fix it?

Wrap your recursive function call into a -

- setTimeout
- setImmediate
- process.nextTick

Also, you can localize the issue by setting a breakpoint on RangeError type of exception , and then adjust the code appropriately.
