# Command failed with exit code 137: yarn build (https://ntl.fyi/exit-code-137)

**URL:** <https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846>\
**Category:** Support\
**Tags:** building\
**Created:** [March 16, 2023, 3:45pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846 "2023-03-16T15:45:16Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcadenaallan](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dcadenaallan/32/37655_2.png) [@dcadenaallan](https://answers.netlify.com/u/dcadenaallan)\
**Post date:** [March 16, 2023, 3:45pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/1 "2023-03-16T15:45:16Z")

</div>

- Netlify site name:  
[https://master--benchmarkprofessional.netlify.app/](https://master--benchmarkprofessional.netlify.app/)
- Build problems

URL Build

> **[Netlify App](https://app.netlify.com/sites/benchmarkprofessional/deploys/641335848244640008a79fd5)**
>
> Start building the best web experiences in record time

 ![image](https://global.discourse-cdn.com/netlify/original/3X/d/7/d76d2f2f6a5bffce6e4b55cb2f4af8097c1e02bc.png)

We’ve had this compile-time error for the past few days and when we run the manual process, sometimes we get the following error.

 ![image](https://global.discourse-cdn.com/netlify/original/3X/3/c/3c9c6472d3be3224959dd089bed6e0b690f1f785.png)

But if we change the maximum memory from the NODE options, we get the first error in all builds.

---

<div class="post-metadata">

**Author:** ![SamO](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/samo/32/41847_2.png) [@SamO](https://answers.netlify.com/u/SamO)\
**Post date:** [March 17, 2023, 3:15pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/2 "2023-03-17T15:15:10Z")

</div>

Hi

Hi there, glad you found us!

First, have you looked through [this resource](https://answers.netlify.com/t/support-guide-compiled-build-and-deploy-resources-start-here/50679)? It is a compilation of all of our build and deploy resources. This is a good starting point.

If you have worked through those guides and are still encountering issues please share the following information:

- what you have already tried
- any error messages you have received in your terminal window or in the developer console

I also recommend you search the forums as this is a common error code and there are several solutions .

---

<div class="post-metadata">

**Author:** ![dcadenaallan](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dcadenaallan/32/37655_2.png) [@dcadenaallan](https://answers.netlify.com/u/dcadenaallan)\
**Post date:** [March 30, 2023, 5:30pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/3 "2023-03-30T17:30:59Z")

</div>

Hi @SamO ,

Yes, searched the forums and tried to apply one of the solutions, which was to increase memory, but this solution was worse.

I don’t know what else to do because the Netlify console doesn’t give me much information.

I don’t know if you can dig deeper and get more information from your side

---

<div class="post-metadata">

**Author:** ![SamO](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/samo/32/41847_2.png) [@SamO](https://answers.netlify.com/u/SamO)\
**Post date:** [March 30, 2023, 7:19pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/4 "2023-03-30T19:19:46Z")

</div>

Have you tried optimising your [build process?](https://answers.netlify.com/t/support-guide-how-can-i-optimize-my-netlify-build-time/3907)

---

<div class="post-metadata">

**Author:** ![dcadenaallan](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dcadenaallan/32/37655_2.png) [@dcadenaallan](https://answers.netlify.com/u/dcadenaallan)\
**Post date:** [April 20, 2023, 3:08pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/5 "2023-04-20T15:08:09Z")

</div>

We couldn’t optimize our construction.

We currently use nuxt and for in express functions.

Right now it’s failing us more often than when I created this post.

What other option do we have to check this problem, is it possible to check from the administration because it sometimes fails ?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [April 23, 2023, 12:06pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/6 "2023-04-23T12:06:18Z")

</div>

The error in your first screenshot shows “killed” as the error message, which means your build tried to use more than the 11 GB allocated RAM. This cannot be changed.

However, your latest deploy: [Netlify App](https://app.netlify.com/sites/benchmarkprofessional/deploys/6443044cdac83e07b0cc9499) failed due to JavaScript heap out of memory, which can be raised by specifying this option: [memory - How do I determine the correct "max-old-space-size" for Node.js? - Stack Overflow](https://stackoverflow.com/questions/48387040/how-do-i-determine-the-correct-max-old-space-size-for-node-js)

---

<div class="post-metadata">

**Author:** ![dcadenaallan](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dcadenaallan/32/37655_2.png) [@dcadenaallan](https://answers.netlify.com/u/dcadenaallan)\
**Post date:** [April 24, 2023, 10:18pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/7 "2023-04-24T22:18:39Z")

</div>

Hi Hrishikesh Kokate, when I change the “max-old-space-size” to 4096 does not solve the problem.

With that change or without the change I keep getting error codes 134 or 137.

What I find very strange is that the problem is not constant, sometimes the build is successfully finished by just giving it a retry. I would like to ask you if the agents are shared, that is, in the same agent you can run different compilations.

Secondly, I can disable the installation of Python, Go, and Ruby. We only use NodeJS.

Here are some recent links with the different errors.

- 134: [Netlify App](https://app.netlify.com/sites/benchmarkprofessional/deploys/6446a7bd06edab0008cc8b82)
- 137: [Netlify App](https://app.netlify.com/sites/benchmarkprofessional/deploys/6446fbfb50689f24a608f927)
- OK: [Netlify App](https://app.netlify.com/sites/benchmarkprofessional/deploys/6446b6eb0dd0650007fc9438)

---

<div class="post-metadata">

**Author:** ![dcadenaallan](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dcadenaallan/32/37655_2.png) [@dcadenaallan](https://answers.netlify.com/u/dcadenaallan)\
**Post date:** [April 25, 2023, 2:55pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/8 "2023-04-25T14:55:31Z")

</div>

Hi @hrishikesh, I am running the compilation on a docker with limited memory of 8GB and 4 CPU. In no time does the Netlify build command fail.

What I see is that at some point the Nuxt construction consumes 90% of the memory, but does not break the construction.

What could cause the current problem in Netlify?

 ![Screenshot from 2023-04-25 09-13-14](https://global.discourse-cdn.com/netlify/original/3X/1/0/10138be2e42cf378945c975c3ea2d939d77b0cd8.png)

---

<div class="post-metadata">

**Author:** ![dcadenaallan](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dcadenaallan/32/37655_2.png) [@dcadenaallan](https://answers.netlify.com/u/dcadenaallan)\
**Post date:** [April 27, 2023, 3:00pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/9 "2023-04-27T15:00:56Z")

</div>

Good morning @hrishikesh @SamO

I appreciate your collaboration with the problem described above, now it is almost impossible to perform a deployment.

We have seen that during the night or very early in the morning, they fail less often.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [April 29, 2023, 11:37am UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/10 "2023-04-29T11:37:10Z")

</div>

I’m not sure what more to suggest, @dcadenaallan. Even in the links you shared:

> [@dcadenaallan](#):
>
> 134: [Netlify App](https://app.netlify.com/sites/benchmarkprofessional/deploys/6446a7bd06edab0008cc8b82)

This again failed with the Heap issue that I mentioned earlier. Not sure if increasing the heap size further would work or not, but that’s the only solution for it.

Regarding the second link:

> [@dcadenaallan](#):
>
> 137: [Netlify App](https://app.netlify.com/sites/benchmarkprofessional/deploys/6446fbfb50689f24a608f927)

As mentioned before, it exceed the RAM limits:

 ![image](https://global.discourse-cdn.com/netlify/original/3X/b/d/bdd5b6ca758035e8e0f69fad6b621dacad4ae8bd.png)

So it crashed. This doesn’t have any solution apart from you having to optimise your build process, or build locally and deploying via CLI.

Regarding the OK build:

> [@dcadenaallan](#):
>
> OK: [Netlify App](https://app.netlify.com/sites/benchmarkprofessional/deploys/6446b6eb0dd0650007fc9438)

 ![image](https://global.discourse-cdn.com/netlify/original/3X/6/9/6933c9d9dc9a2348493d7e4c737474483882aed2.png)

It was almost close to crashing as well. It does look like your build process is going out of platform limitations.

The only suggestion or workaround you can use right now is to build locally and deploy via CLI, or move that process to GitHub Actions or something so you can deploy from there.

---

<div class="post-metadata">

**Author:** ![dcadenaallan](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dcadenaallan/32/37655_2.png) [@dcadenaallan](https://answers.netlify.com/u/dcadenaallan)\
**Post date:** [May 2, 2023, 2:48pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/12 "2023-05-02T14:48:36Z")

</div>

Do you have any official Netlify Github Accion?

---

<div class="post-metadata">

**Author:** ![SamO](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/samo/32/41847_2.png) [@SamO](https://answers.netlify.com/u/SamO)\
**Post date:** [May 4, 2023, 6:42pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/13 "2023-05-04T18:42:38Z")

</div>

There is [Netlify Action](https://github.com/marketplace/actions/netlify-actions) which is NOT affiliated with Netlify. Or are you referring to our [Netlify Github account.](https://github.com/netlify)

---

<div class="post-metadata">

**Author:** ![dcadenaallan](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dcadenaallan/32/37655_2.png) [@dcadenaallan](https://answers.netlify.com/u/dcadenaallan)\
**Post date:** [May 12, 2023, 4:59pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/15 "2023-05-12T16:59:00Z")

</div>

Hi Sam

We are having problems with the deployment of branches from the CLI, unlike the deploy-previews and the production ones that are completed correctly.

A clear example would be with the master branch, deployment is made from GitHub actions with the CLI and no changes are seen.

![image](https://global.discourse-cdn.com/netlify/original/3X/1/4/146c04897e6995b9d7334317842a5009afa0e1fb.png)

`yarn netlify:deploy --build "yarn netlify:build" --context "branch-deploy" --dir "dist" --functions ".netlify/functions" --json --message "Deploy from Github Actions" --debug --prod "false" --alias "master"`

It is a known problem? that we could do?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [May 13, 2023, 7:00pm UTC](https://answers.netlify.com/t/command-failed-with-exit-code-137-yarn-build-https-ntl-fyi-exit-code-137/87846/16 "2023-05-13T19:00:02Z")

</div>

Netlify CLI is not really meant to do branch deploys - and they don’t even work as real branch deploys. Sure, you can set an `alias`, but that’s about it.

I believe your issue is happening due to specifying the `alias` flag. I haven’t checked in detail for your site, but if you used to have a branch deploy with the same name that you’re trying to set as an alias, it would cause content not updating issue.
