Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum call stack size exceeded on npm install

I'm trying to run npm install, this is output from console:

npm ERR! Linux 4.8.0-27-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" npm ERR! node v6.9.1 npm ERR! npm  v3.10.8  npm ERR! Maximum call stack size exceeded npm ERR!  npm ERR! If you need help, you may report this error at: npm ERR!     <https://github.com/npm/npm/issues> 

and this is content of npm-debug.log:

113791 verbose stack RangeError: Maximum call stack size exceeded 113791 verbose stack     at Object.color (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/console-control-strings/index.js:115:32) 113791 verbose stack     at EventEmitter.log._format (/usr/lib/node_modules/npm/node_modules/npmlog/log.js:252:51) 113791 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/log.js:138:24) 113791 verbose stack     at emitThree (events.js:116:13) 113791 verbose stack     at emit (events.js:194:7) 113791 verbose stack     at .<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/tracker-group.js:23:18) 113791 verbose stack     at emitThree (events.js:116:13) 113791 verbose stack     at emit (events.js:194:7) 113791 verbose stack     at .<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/tracker-group.js:23:18) 113791 verbose stack     at emitThree (events.js:116:13) 113791 verbose stack     at emit (events.js:194:7) 113792 verbose cwd /home/giorgi/AdMove/dev/web-advertiser-admove 113793 error Linux 4.8.0-27-generic 113794 error argv "/usr/bin/nodejs" "/usr/bin/npm" "install" 113795 error node v6.9.1 113796 error npm  v3.10.8 113797 error Maximum call stack size exceeded 113798 error If you need help, you may report this error at: 113798 error     <https://github.com/npm/npm/issues> 113799 verbose exit [ 1, true ] 

Removed node_modules several times and tried to reinstall. Can't understand what's the reason that causes this and how to fix it.

like image 859
GROX13 Avatar asked Nov 12 '16 18:11

GROX13


People also ask

How do I fix maximum call stack size exceeded npm?

If you don't want to run npm install every time you change the NodeJS version, then I recommend you to use Node Version Manager to install multiple NodeJS versions on your local computer. You should be able to install all dependencies without the maximum call stack size exceeded error now.

How do I fix error in maximum call stack size exceeded?

The call stack is limited in size, and when it's exceeded, the RangeError is thrown. This can happen when a deeply nested function is called, or when a lot of new variables are created. The most common way to fix this error is to reduce the number of function calls, or to limit the number of variables that are created.

What is maximum call stack error?

It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you hit the call stack limit. This is almost always because of a recursive function with a base case that isn't being met.

What is Max call stack size?

Without any local variables, each function call takes up 48 bytes during the execution, and you are limited to less than 1MB for all local function frames.


1 Answers

metzelder's answer helped me fix the issue. however if you run the command npm cache clean, it will give you a message

As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid

So, as of npm5 you can do by adding a --force flag to the command.

So the command is:

npm cache clean --force 
like image 181
codingbruh Avatar answered Sep 21 '22 09:09

codingbruh