ESLint - 'process' is not defined

When I got error I had "browser": true instead of "node": true.

I have fixed this with following config for .eslintrc.json file-

{
    "env": {
        "node": true,
        "commonjs": true
    },
    "extends": "eslint:recommended",
    "rules": {
        "indent": [
            "error",
            "tab"
        ],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "quotes": [
            "error",
            "single"
        ],
        "semi": [
            "error",
            "always"
        ]
    },
    "parserOptions": {
        "ecmaVersion": 2015
    }
}

Thanks @FelixKling and @Jaromanda X for quick responses.


Add .eslintrc file to root of your project (if you don't already have one) and define globals to ignore

{
    "globals": {
        "process": true
      }
}

Make sure you use process.env though out the project but only in a single configuration file. Consider adding no-process-envrule.

https://eslint.org/docs/rules/no-process-env


Adding "node": "true" to an existing list of environments will do the job, too

"env": {
        "node": true,
        "commonjs": true,
        "browser": true,
        "es6": true
       }