Reputation: 1795
can you please help me out of this.
Upvotes: 15
Views: 51484
Reputation: 1
"FATAL ERROR" occurs when uninstalling any packages. Try to run this command in your terminal.
npm cache clean -f
The npm cache can sometimes lead to issues, such as outdated or corrupt cached data, causing unexpected behavior during package installation or updates.
Upvotes: 0
Reputation: 49
The problem node.js process consuming more memory over time , so increased the memory allocation for the Node.js process. which can be helpful for handling larger applications or projects with heavy memory usage.
The command used for : "node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng serve"
Upvotes: 0
Reputation: 2042
As of Node.js v8.0 shipped August 2017, you can use the NODE_OPTIONS environment variable to set the max_old_space_size globally
export NODE_OPTIONS=--max_old_space_size=4096
@see https://www.npmjs.com/package/increase-memory-limit
Upvotes: 2
Reputation: 385
After tried all solutions above and in other threads, i realized i installed 32 bit node js instead of 64bit (angular 16 but the problem is not angular version related)
Upvotes: 3
Reputation: 970
GIT BASH: ENV NODE_OPTIONS=--max_old_space_size=8048 && ng build
CMD SET NODE_OPTIONS=--max_old_space_size=8048 && ng build
Upvotes: 1
Reputation: 1144
I found this error comes from the generation of source maps. Disabling source maps will make the error go away.
Since most need source maps, using the solution for increase memory in npm scripts instead of disabling source maps, solves it.
example:
scripts: {
"build": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build",
"serve": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng serve"
}
Upvotes: 9
Reputation: 3726
You can allocate more memory for your build/start task in order to compile:
node --max_old_space_size=4096 ./node_modules/.bin/ng build
And, according to an answer to this question: "export 'DOCUMENT' was not found in '@angular/platform-browser', DOCUMENT
has been moved to @angular/common
. So you also have to change your imports for your code to compile.
Upvotes: 3
Reputation:
Set an environment variable:
SET NODE_OPTIONS=--max_old_space_size=8048
Upvotes: 11