Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loopback giving Maximum call stack size exceeded error

I have set up my Loopback project and installed other packages required to run my project. Whenever I tried to run the application with the command within the folder

    node . 

it is raising following error:

test_app/node_modules/strong-remoting/lib/shared-method.js:157
  if (/^prototype\./.test(name)) {
                     ^

RangeError: Maximum call stack size exceeded

I am literally unknown about this error. Can you please suggest any solution?

like image 447
Sijan Bhandari Avatar asked Oct 24 '17 12:10

Sijan Bhandari


People also ask

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 does it mean when maximum call stack size exceeded?

The JavaScript exception "too much recursion" or "Maximum call stack size exceeded" occurs when there are too many function calls, or a function is missing a base case.

What is the maximum call stack size in JS?

The consequences of applying a function with too many arguments (think more than tens of thousands of arguments) vary across engines (JavaScriptCore has hard-coded argument limit of 65536), because the limit (indeed even the nature of any excessively-large-stack behavior) is unspecified.


1 Answers

I had the same issue and this worked for me:

  1. Go in your models folder which should be somewhere --> /projectfolder/common/models/

  2. Open the files of the models you just set your relation about --> yourmodel.json

  3. Delete this part in your "relations" -->

     "options": {
       "nestRemoting": true
     }
    
  4. If you have set 2 relations such as hasMany and belongesTo you should apply this to booth.

like image 165
Taulant Avatar answered Sep 18 '22 01:09

Taulant