diff --git a/lib/linter.js b/lib/linter.js index 649b4e6..ec87f42 100644 --- a/lib/linter.js +++ b/lib/linter.js @@ -29,7 +29,13 @@ module.exports = function (cwd, args, text) { process.chdir(cwd); var cwdEslint = eslintMap[cwd]; if (!cwdEslint) { - var cwdPath = resolve.sync('eslint', { basedir: cwd }); + var cwdPath; + // resolve will throw an error, if module not found + try { + cwdPath = resolve.sync('eslint', { basedir: cwd }); + } catch (e) { + // module not found + } cwdEslint = cwdPath ? require(cwdPath) : require('eslint'); eslintMap[cwd] = cwdEslint; }