Ask coding questions

← Back to all posts
Next.js on replit keeps running out of memory


I am making the frontend of a fullstack web app with next.js typescript using a template and my repl keeps crashing and running out of memory when I try to run it.


I am learning full-stack web development with Nodejs and my idea was that I would make the backend in one repl, and the frontend in the other.

After making the backend, I moved on to making the frontend with Next.JS. However, I wanted to use typescript with it, so I used a Next.JS starter typescript template. When starting my repl, I just cloned a blank repo from github and then chose typescript in my .replit config.

Anyway, when I tried running the yarn dev command, the repl worked properly. I was able to start development and things were going good. The next day, when I tried doing the exact same thing, the command failed with error 137 (running out of memory) :(.

I looked for a Next.js template on replit because I assumed they would be faster, but I only found one for javascript.
I also deleted some of my old repls, so it really shouldn't be my repl storage.


  1. Does anyone know why a starter next.js template is crashing on ( is this a bug )? What happens when you guys press the run button on my repl?

  2. Is there any way to use a next.js typescript template on What do you use for making next.js on replit

PS: PLEASE WORK I NEED HELP LOL. Also, tell me if I was unclear on anything.


It looks like you have a free account rather than a Hacker one. This means you will only be able to access limited resources such as CPU and RAM. Maybe this is why you are running out of memory.



I know that, but don't you think that free accounts should be able to at least run a next.js project? Also, it was working just the day before. Does it work for you?


@Plorzon Yes. The starter template nextjs app is very basic so there should not be any issues. The hidden node_modules folder, where all the dependencies live, is only 89M so that should not be an issue. have you had any success?


I have decided to switch to codesandbox for next.js projects. They have optimization for next.js and node_modules in general. Also, lacks typescript stuff and types support. I still LOVE, but it sorta sucks for next.js from my experience. (I might be wrong on this but the following paragraph explains why I believe so)

Yes, I did have success with the template on, but then odd errors came up related to npm packages. It kept on saying that webpack was missing a certain library which chakra-ui depends on called @emotion/core. When I installed @emotion/core, it said that @emotion/core has been renamed to @emotion/react. When I installed @emotion/react, another error came up which I couldn't remember. After spending a couple of hours debugging the issue, I decided to switch to code sandbox, and to my surprise everything worked like butter!

PS: Accepting your answer cause it helped and you were correct...


@Plorzon All the best with Codesandbox. Have you thought of setting up a development environment on your own computer? Mine runs a version of Linux (MX-19) and it's quite easy to set up such environments.


Ughhh I wish... I don't have access to a PC right now because I am travelling, I am doing stuff on chromebook. Having an environment on a PC is almost always better for running stuff like this. SIGH
I can imagine how nice it is to have a Linux environment.

Thanks for all the help!