我一直试图让ESLint在VS代码中进行一个新的角度项目,但是它没有加载“@typescript eslint/eslint”。在过去的三个小时里,我一直试图找出问题的所在,并到处寻找解决方案。
Failed to load plugin '@typescript-eslint' declared in 'png-ui/.eslintrc.js': Cannot find module '@typescript-eslint/eslint-plugin'
Require stack:
- /Users/Yahia/Desktop/Plugngrow-UI/__placeholder__.js
Referenced from: /Users/Yahia/Desktop/Plugngrow-UI/png-ui/.eslintrc.js
Happened while validating /Users/Yahia/Desktop/Plugngrow-UI/png-ui/.eslintrc.js
This can happen for a couple of reasons:
1. The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc).
2. If ESLint is installed globally, then make sure '@typescript-eslint/eslint-plugin' is installed globally as well.
3. If ESLint is installed locally, then '@typescript-eslint/eslint-plugin' isn't installed correctly.
Consider running eslint --debug /Users/Yahia/Desktop/Plugngrow-UI/png-ui/.eslintrc.js from a terminal to obtain a trace about the configuration files used.调试到目前为止所采取的步骤:
ng new命令创建的。eslint --debug /Users/Yahia/Desktop/Plugngrow-UI/png-ui/.eslintrc.js命令。它只会导致在调试过程中忽略".eslintrc.js“文件的警告。请注意,在另一个项目中,ESLint工作得很好,我在做介绍性教程时从角度文档下载了这个项目。
如果这有助于检查,我已经为项目创建了一个Github回购。
请原谅我在编程和相关工具方面的新鲜感。
发布于 2021-02-18 22:09:20
我昨天刚遇到这个问题。我建议您在本地重新安装“@typescript eslint/eslint”,并查看该帮助。您还可以对eslintrc.js文件进行新的设置,并且应该很容易修复。
这个链接很有帮助。https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project
https://stackoverflow.com/questions/59287268
复制相似问题