Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Bradley James Ahrens's avatar

Laravel Forge - "killed" - npm verb exit 137

Hey guys,

I recently updated the versions of Node and NPM on my server on Forge from Node v14.19.0 to v18.17.1 and NPM v.6.14.16 to v9.6.7. I have also updated my dependencies. Not sure if this is relevant, but I needed to change Forge's password on the server.

When deploying, npm install runs fine but when I run npm run dev, I always get the response "Killed" from Forge. Specifically "npm verb exit 137", which indicates that I have run out of memory.

I have tried to fix this by adding the max-old-space-size to my script:

"dev": "NODE_OPTIONS=\"--max-old-space-size=1536\" mix "

However, this hasn't helped and the I keep getting the same error.

Any idea what could be happening here and how to fix it?

Thanks!

0 likes
6 replies
LaryAI's avatar
Level 58

The error message "Killed" and "npm verb exit 137" indicate that the process was terminated due to running out of memory. To fix this issue, you can try increasing the memory limit for the Node process.

One possible solution is to add the --max-old-space-size flag to the NODE_OPTIONS environment variable in your npm run dev script. However, it seems that you have already tried this approach without success.

Another option is to increase the memory limit directly in your Laravel Forge server configuration. Here's how you can do it:

  1. Log in to your Laravel Forge account and navigate to your server.
  2. Go to the "Web Server" tab and click on the "Edit Environment" button.
  3. In the "Environment Variables" section, add a new variable with the following details:
    • Variable: NODE_OPTIONS
    • Value: --max-old-space-size=1536
  4. Save the changes and redeploy your application.

If increasing the memory limit still doesn't solve the issue, you may need to further investigate the cause of the memory consumption. It's possible that there are other factors contributing to the high memory usage, such as inefficient code or large dependencies.

Additionally, you can try running the npm run dev command directly on the server via SSH to see if you get more detailed error messages. This can help identify the specific cause of the memory issue.

ssh forge@your-server-ip
cd /path/to/your/project
npm run dev

If you're still experiencing issues, it may be helpful to provide more information about your project setup, such as the Laravel and Node versions, and any other relevant details.

Bradley James Ahrens's avatar

@LaryAI I tried increasing the max-old-space-size to 1536 as mentioned and running it again on Forge. It gave me the same error.

I then tried running npm run dev on my server via SSH and it almost got there, stopping at 98% before it died:

Here is the output:

> dev
> mix

QUEUE_CONNECTION set to "redis", make sure to start a queue worker.

● Mix █████████████████████████ emitting (98%)
 after emit

Outbound Data: File generated!
Ziggy Routes: Files generated!
Killed
NoLAstNamE's avatar

Why do you need to run npm run dev?

Should be npm run build, right?

Bradley James Ahrens's avatar
Level 20

In case anyone has this problem in the future, my issue was that, when I upgraded Node and NPM, npm run dev was taking up too much memory. So, with my staging server running on a t3.small with only 2GB of memory, it was timing out. Once I upgraded to a t3.medium, this was no longer an issue and solved the problem.

Please or to participate in this conversation.