Skip to content
Advertisement

Eslint – Maximum call stack size exceeded

Working in a React / Webpack project I started to have problems with the eslint library.

The eslint package is downloaded using npm and it’s used to validate the project using a webpack preLoader.

        preLoaders: [{
            test: /.jsx?$/,
            loaders: [ 'eslint' ],
            include: path.resolve(__dirname, 'app')
        }]

It used to work fine until recently when I tried to git clone the same project to an other folder. After installing the dependencies “npm install” and starting the project “npm start” the following error appeared.

    ERROR in ./main.view.jsx
Module build failed: RangeError: Maximum call stack size exceeded
    at keys (native)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:78:24)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:93:26)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:93:26)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:88:38)
    at Referencer.Visitor.visit (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:112:14)
    at Referencer.Visitor.visitChildren (project/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:93:26)
 @ ./app.jsx 17:26-57

The strange part of all is that the old project installation still works.

The problem must be somewhere in the node_modules folder because when I copy the modules from the old installation to the new one the project suddenly works. I did a “npm list –depth=0” on both projects and both have the same packages and versions. Why one is working and the other one not?

I guess the problem is in the eslint package because when I remove the preLoader it works again.

I’m really confused about that. Someone had that problem before?

My main.view.jsx looks like that

import React from 'react';
export default class MainView extends React.Component {
    render() {
        return (
            <div />
        );
    }
}

Thanks!

Advertisement

Answer

I could solve the problem by myself.

Isolating everything I found out that the problem was the babel dependencies.

For some reason the combination of versions I had of babel-core, babel-loader and babel-eslint where not working properly together. I changed the babel versions required for my project in the package.json and now everything works fine.

-    "babel-core": "5.6.x",
-    "babel-loader": "5.3.x",
-    "babel-eslint": "3.1.x",
+    "babel-core": "5.8.x",
+    "babel-loader": "5.4.x",
+    "babel-eslint": "4.1.x",

Here my eslint dependencies

"eslint": "1.10.x",
"eslint-loader": "1.1.x",
"eslint-plugin-react": "3.10.x"

Hope the time I lost with that will help someone else!

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement