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 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
}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值