ESLint couldn‘t find the plugin “eslint-plugin-vue“
ESLint couldn't find the plugin "eslint-plugin-vue".(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "/Users/zhangqi/Desktop".)It's likely that the plugin
ESLint couldn't find the plugin "eslint-plugin-vue".
(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "/Users/zhangqi/Desktop".)
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
npm install eslint-plugin-vue@latest --save-dev
The plugin "eslint-plugin-vue" was referenced from the config file in "../../.eslintrc.js".
If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.
在学习 eslint 时,安装官方文档步骤操作,在执行 yarn run eslint test.js 时,报了以上错误。倒数第二行说 …/…/.eslintrc.js 中引用了 eslint-plugin-vue 。问题就在这里了,…/…/.eslintrc.js 明显不在当前文件夹,我的 eslint-plugin-vue 又没全局安装。
出现前一个错误时,我想我要运行的是 ./.eslintrc.js 但是却使用了…/…/.eslintrc.js。那么我将上层的多余的删除不就可以了吗,当然结果也是成功了。后来我想看看这个多余的 .eslintrc.js 是怎么生成的,其实就是我执行yarn run eslint --init 之前并没yarn init 在文件夹下生成 package.json 。然后创建的 .eslintrc.js 就跑到外面去了,位置是 …/…/…/ 。然后 yarn run eslint test.js 提示如下:
(node:17707) [ESLINT_PERSONAL_CONFIG_SUPPRESS] DeprecationWarning: '~/.eslintrc.*' config files have been deprecated. Please remove it or add 'root:true' to the config files in your projects in order to avoid loading '~/.eslintrc.*' accidentally. (found in "../../../.eslintrc.js")
提示 Please remove it or add ‘root:true’ to the config files in your projects ,然后我就知道了两个方式,一个是之前的删除外部的 .eslintrc.js 。一个是修改当前文件夹下的 .eslintrc.js
module.exports = {
root: true
}
更多推荐
所有评论(0)