Error: require() of ES Module xxx stylish.js not supported

yarn lint
yarn run v1.22.22
$ eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0
There was a problem loading formatter: /Users/**/node_modules/eslint/lib/cli-engine/formatters/stylish
Error: require() of ES Module /Users/**/node_modules/strip-ansi/index.js from /Users/**/node_modules/eslint/lib/cli-engine/formatters/stylish.js not supported.
Instead change the require of index.js in /Users/**/node_modules/eslint/lib/cli-engine/formatters/stylish.js to a dynamic import() which is available in all CommonJS modules.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

解决:

一、package.json中添加下面代码,强制使用安装的依赖版本
"resolutions": {
    "strip-ansi": "6.0.0"
  }
  
二、
yarn
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值