There was a serious issue: The mark-compacts were not working effectively near the heap limit, resulting in allocation failure - the JavaScript heap ran out of memory during the

I recently set up a t2.micro server on AWS and encountered an issue when running our application with the command "sudo npm start". The error message I received was:

"FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory"

I tried various solutions such as upgrading the node version and setting NODE_OPTIONS=--max-old-space-size=1024, but unfortunately, none of them worked for me. Could someone please assist me in resolving this issue?

Start script: tsc && node dist/index.js

Thank you

Answer №1

It seems like your project is struggling due to memory limitations on a t2.micro instance. Typescript builds tend to be resource-intensive.

To address this issue, you have a couple of options:

  • Consider setting up swap memory on the machine by following instructions at . Keep in mind that this solution may not provide optimal performance.
  • A more efficient approach would be to build your project using a more powerful machine and then execute the compiled JavaScript on the micro instance by running node dist/index.js.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Can you tell me if the "dom model" concept belongs to the realm of HTML or JavaScript?

Is the ability to use "document.X" in JavaScript to visit an HTML page and all its tags defined by the HTML protocol or the ECMAScript protocol? Or is it simply a choice made in the implementation of JavaScript, resulting in slight differences in every bro ...

What is the alternative command to npm ci in pnpm?

Can you explain the equivalent command for npm ci in pnpm? Referencing the documentation for npm install: pnpm install is utilized for installing all dependencies within a project. In instances of a CI environment, installation may fail if a lockfile exi ...

Angular: NaNa: Attempting to access a property of an undefined variable

I've encountered these errors although the values are displayed correctly in the browser. I'm unsure about how to resolve this issue. ERROR TypeError: Cannot read property 'length' of undefined ERROR TypeError: Cannot read property &ap ...

RXJS buffering with intermittent intervals

Situation: I am receiving audio data as an array and need to play it in sequence. The data is coming in continuously, so I am using an observable to handle it. Since the data arrives faster than it can be played, I want to use a buffer to store the data w ...

Why is it necessary in JavaScript to reset the function's prototype after resetting the function prototype constructor as well?

Code is often written in the following manner: function G() {}; var item = {...} G.prototype = item; G.prototype.constructor = G // What is the purpose of this line? Why do we need to include G.prototype = item before resetting the prototype? What exact ...

Why is middleware being triggered even if the specified mount path is not its own?

As a beginner in the world of node and express, I am delving into exploration. Recently, I created two middleware functions each with its own mount path. Surprisingly, MIDDLEWARE 2 is being invoked even when the incoming request is not intended for it. ...

Issue with jQuery function not recognizing escaped double quotes in PHP script

Greetings! I am currently utilizing a custom control with PHP code. $parentLinkCombo = '<select name="ParentComboLink" onchange="changeChildCombo(\"LICENCE\");" id="ParentComboLink" >'; In order to handle the onchange event, I ...

Guide on removing query parameters post a redirect using NextJS

Is there a way in NextJS to redirect a URL like /page?foo=bar to /page/bar? I checked out the documentation at https://nextjs.org/docs/api-reference/next.config.js/redirects but couldn't find a solution. This is what I have tried so far: { source: ...

Get access to a plethora of files from NPM for download

Currently, I am immersed in a hobby project focusing on analyzing numerous NodeJS packages. The go-to source for these packages is npm, but my dilemma lies in downloading a large quantity of them (500+). Whether it's the top 500 most popular or random ...

What is the method for accessing the Redux store content directly in the console, without using any developer tools

By utilizing React Devtools, I am able to access the store by: $r.store.getState() Is there an alternate method to retrieve the store without using React Devtools? ...

The type of props injected by WithStyles

When working on my class component, I utilize material UI withStyles to inject classes as a property. export default withStyles(styles)(myComponent) In this process, const styles = ( (theme:Theme) => createStyles({className:CSS_PROPERTIES}) I am att ...

React components featuring Material UI icons

I'm in need of assistance. I am looking for the Material UI icons, but I can't seem to find any information on how to obtain them. https://i.stack.imgur.com/FAUc7.jpg ...

Ensuring a successful installation of SQLite for Node.js

I am currently trying to install SQLite for Node.js as per the following instructions: apt-get install sqlite3 apt-get install libsqlite3-dev npm install sqlite3 However, when I use the code snippet below: var db = new require('sqlite3').verbo ...

What is the method to determine the number of keys that have the same value in a JavaScript object?

My goal is to achieve functionality similar to this: var data = [ { tag:'A', others:'Abc' }, { tag:'B', others:'Bbc' }, { tag:'A', others ...

Utilizing AJAX for passport verification and validation

My objective is to implement user authentication through ajax using passport. The usual method of utilizing passport involves initiating the authorization process with a GET request triggered by a standard <a> tag. Once the authentication is successf ...

Using GSAP in an Ionic application

What is the best way to add the GSAP library to an Ionic project? Simply running npm install gsap doesn't seem to work when I try to import it using: import { TweenMax, TimelineMax} from "gsap"; I am currently using TypeScript. Thank you. ...

Is it possible to keep my JavaScript scripts running continuously within my HTML code?

I recently set up a JavaScript file that continuously queries an API for updates. It's currently linked to my index.html, but I'm looking for a way to keep it live and running 24/7 without requiring the browser to be open. Any suggestions on how ...

Scheduling a cron job to run at a particular date and time

Our express js application includes a feature in the admin module where users can send emails at specific dates and times they select. For example, if the chosen date and time is [email protected], we need to execute the email code at that exact time ...

fakeAsync failing to synchronize with async task completion

Scenario In my testing process, I am evaluating a component that utilizes an observable-based service to retrieve and display data for internationalization purposes. The i18n service is custom-made to cater to specific requirements. While the component ...

Step-by-step Guide to Setting pageProps Property in Next.js Pages

When looking at the code snippet provided in .../pages/_app.js, the Component refers to the component that is being exported from the current page. For instance, if you were to visit , the exported component in .../pages/about.js would be assigned as the ...