与escope的eslint / babel-eslint问题

时间:2017-05-31 16:41:19

标签: babeljs babel eslint

当我尝试在本地运行eslint时出现此错误:

Error: Cannot find module 'escope' at Function.Module._resolveFilename (module.js:455:15) at monkeypatch (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/babel-eslint/index.js:53:26) at Object.exports.parse (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/babel-eslint/index.js:358:5) at parse (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/linter.js:671:23) at Linter.verify (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/linter.js:806:27) at processText (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/cli-engine.js:278:31) at processFile (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/cli-engine.js:320:18) at executeOnFile (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/cli-engine.js:655:25) at fileList.forEach.fileInfo (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/cli-engine.js:693:13) at Array.forEach (native)

我使用相同的 linting配置与另一个项目有什么奇怪之处,我完全没有问题。

我正在使用: babel-eslint@7.1.1 eslint@4.0.0-beta.0

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

即使我有相同的package.json,babel-eslint也设置为" 7.1.1"在一个和" ^ 7.1.1"在另一个。

基本上ESLint v4使用新的escope分支,然后在babel-eslint的7.2.3版本上更新。

所以,在我的配置中添加小^修复了我的问题。