Failed to load plugin jsdoc: Cannot find module ‘eslint-plugin-jsdoc‘

在 egg 项目中,初次安装 npm 包的时候,报错如下:

Oops! Something went wrong! :(

ESLint: 5.16.0.
ESLint couldn't find the plugin "eslint-plugin-jsdoc". This can happen for a couple different reasons:

1. If ESLint is installed globally, then make sure eslint-plugin-jsdoc is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.

2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

     npm i eslint-plugin-jsdoc@latest --save-dev

Path to ESLint package: /Users/***/node_modules/eslint

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

ESlint 也自然是没有正常工作,并且当文件不符合 ESlint 规则时,在控制台日志报错如下:

Failed to load plugin jsdoc: Cannot find module 'eslint-plugin-jsdoc'....

原因:

npm v8.0 在安装项目依赖的时候,没有正确安装上项目依赖(eslint-config-egg)的依赖(eslint-plugin-jsdoc)

解决:

将 npm 升级到 v8.1.2 后,删除项目中的 node_modules 和 package-lock.json,然后重新安装

rm -rf node_modules
rm package-lock.json
npm i

补充:

如果你有同样的报错,可以通过全局搜索 eslint-plugin-jsdoc,配合 npm 命令定位依赖关系

➜  *** git:(master) ✗ npm ls eslint-plugin-jsdoc
***@1.0.0 /Users/***
└─┬ eslint-config-egg@7.5.1
  └── eslint-plugin-jsdoc@4.8.4

进而判定是要手动安装还是升级 npm 或者因为其他原因导致的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值