Encountering an issue saving files in Angular 2 when the npm server is active

Encountering an issue when trying to save .ts or .html files while npm is running

 1: DoJoin(aka DoJoin) [native array.js:~129] [pc=0000035BB365DBB2] 
(this=0000005A3F604381 <undefined>,w=000003CB8840CFF1 <JS 
Array[104]>,x=104,N=0000005A3F6043C1
 <true>,J=000000DB8B0DB361 <String[2]: , >,I=0000005A3F6B46F1 <JS Function 
ConvertToString (SharedFunctionInfo 0000005A3F652DC9)>)
2: Join(aka Join) [native array.js:180] [pc=0000035BB3A1FB52] 
(this=0000005A3F604381 <undefined...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Answer №1

In case angular-cli doesn't have enough memory allocated, you can increase it by making changes to the ng.cmd (or sh depending on your operating system) located at

C:\Users\%userName%\AppData\Roaming\npm
. Here is how you can do it:

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe" --max_old_space_size=8048 "%~dp0\node_modules\@angular\cli\bin\ng" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node --max_old_space_size=8048 "%~dp0\node_modules\@angular\cli\bin\ng" %*
)

(Please note that paths may vary based on your particular system)

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

The concept of Material Design: Utilizing a grid system with automatic card height

Is there a way to create a grid with cards that have auto height, similar to this example: I am currently using Material Design and Angular 4, but I am also open to solutions involving React or VueJS. I have tried using the flex-layout dependency, but I a ...

Is there any way to deactivate the saved query in react-admin without having to develop a new component?

The latest version of react-admin, version 4, introduced a new feature that allows saving filters. I'm curious about how to disable this functionality without having to create an additional filter button. https://i.stack.imgur.com/uTrUe.gif ...

Ways to retrieve form information from a POST request

I received a POST request from my payment gateway with the following form data: Upon trying to fetch the data using the code snippet below, I encountered errors and gibberish content: this.http .post<any>('https://xyz.app/test', { ti ...

What is the best way to refresh a personalized form element using Angular?

I have developed a custom form control with validation that utilizes a standalone FormControl to manage the value and perform certain validations. Is there a method in Angular to reset the inner FormControl when the control is being reset from another For ...

Retrieving Child Route Parameters in Angular 7

Fetching the parameter 'id' only from the corresponding page component seems to be a challenge. The params id cannot be accessed from other individual components such as the header component. //The code snippet below works only in the correspond ...

How can you set a value to a radio button with Angular 4?

How can I set the JSON value for the radio buttons (Unlimited, Custom) below? I tried using [(ngModel)]="user.accessSchedule.fullAccess", but it's not working. <ol-radio-group [selected]="unlimitedAccessSchedule" id="accessSchedule" [(ngModel)]=" ...

Tips on modifying the selected type key name through Pick?

I currently have this structure: type Product = { name: string } and I am looking to extract the name property and use it in a different type declaration like so: type NewProduct = Pick<Product, 'name'> Now, I want to rename name as new ...

Creating Angular 2 projects effortlessly with Angular-Cli 1.0.0: A step-by-step guide

With the official release of Angular-Cli v.1.0.0 and Angular v.4.0.0, the default project created with ng new is now an Angular v.4 project. However, I still prefer to create Angular v.2 projects by default. Is there a way to set this as a global config s ...

Retrieve the weekday dates for a specific year, month, and relative week number using Javascript or Typescript

I am in need of a custom function called getDaysOfWeekDates that can take a year, a month (ranging from 0 to 11), and the week number of each month (usually 4-5 weeks per month) as parameters, and return a list of dates containing each day of that particul ...

CORS policy causing Socket.io communication issues in a Node.js and Angular app

I have a node.js server running with express and socket.io. When I try to communicate with a simple JavaScript client, everything works fine. However, when I attempt to establish communication with an Angular app (using ngx-socket-io), I encounter the foll ...

Is there a way to incorporate the router into the observable within the guard?

Is there a way to inject a router into my guard when I have an Observable method returned? I want to implement routing with a redirect to the login page if a certain condition is met: If the result of the isAccessToLobby method is false, then redirect to t ...

Verify the authenticity of the Jwt Token in Angular

For the purpose of creating a JWT token, I possess both a public key and a private key. To generate the JWT token, the private key is used, while for verifying its validity, the public key comes into play. The following code snippet is employed on the ser ...

Decoding request header in Angular during app initialization

Currently, I have three domain names registered with Godaddy and they are all directing to the same server that is hosting my Angular 2 application. I am curious if there is a method to examine the request header in order to identify which of the three d ...

Utilizing Typescript, create a customized dropdown with react-bootstrap for a tailored user

I've been working on incorporating a custom toggle drop-down feature based on the example provided on the react-bootstrap page, using Typescript and react functional components. Below is the code snippet for my component: import React from &apos ...

How can we encapsulate the dx-data-grid along with its tools within a separate component and effectively manage it as a controller component?

We've been working on an angular application using devexpress.com. I'm trying to create a 'my-grid' controller with dx-data-grid, and I want to integrate dx-data-grid tools into it. However, I encountered an issue while attempting this. ...

Discovering the root cause of an Angular binding failure

In my Angular application, I have implemented support for multiple browser tabs using angular-redux @select and {{ property }} bindings. Everything was working fine until I decided to configure my angular store with the redux-state-sync middleware to use b ...

How can you reposition a component within the dom using Angular?

Just started learning Angular, so I'm hoping this question is simple :) Without getting too specific with code, I could use some guidance to point me in the right direction. I'm currently developing a small shopping list application. The idea i ...

Incorporating Paypal subscription functionality and refining subscription challenges

The angular project I'm working on requires configuring a PayPal payment gateway for create subscription, cancel subscription, and upgrade subscription functionalities. I have encountered two issues with PayPal: 1) The PayPal button has been success ...

Is it possible to use TypeScript or Angular to disable or remove arrow key navigation from a PrimeNG Table programmatically?

Is there a way to programmatically prevent left and right arrow key navigation in a PrimeNG Table with cell editing, without the need to modify the Table component source code? You can check out an example here: Angular Primeng Tableedit Demo code. I mana ...

Next.js page freezes when Axios request is made causing the tab to become unresponsive

Curious about how to troubleshoot (or where to start) with my current Axios problem. I am working on a Next.js project (12.3) and have an axios interceptor hook that manages all of my internal requests. The interceptor functions properly on every action/pa ...