Atom 不断抛出 babel-eslint 错误

Atom throwing babel-eslint error constantly

起初,如果 eslint 在 React 项目中没有被保存为依赖项,atom 会抛出这个错误,它会弹出一个红色通知。 现在我在一个 不是 的目录中工作 git 回购,每当我尝试输入时它都会不断地启动这个错误。这是我看到的:

Error: Cannot find module 'babel-eslint'
    at Object.ModuleResolver.resolve (/Users/josetello/.atom/packages/linter-eslint/node_modules/eslint/lib/util/module-resolver.js:75:19)

我试过在 atom 中更新 eslint/babel 包,卸载它们,在 atom 配置文件中四处寻找关于这可能是什么的提示,但没有成功。这让我抓狂 - 还有其他人 运行 喜欢类似的东西吗?

您可以通过将目录更改为以下内容来解决此问题:

~/.atom/packages/linter-eslint/

然后运行:

npm install babel-eslint

您需要确保在项目 GitHub 存储库中有 Node installed and npm in your path for the above to work. I also recommend reporting the issue as a defect

试试这个设置:

您不需要添加 babel-eslint 作为依赖项。只需在 Atom 中检查此设置。