npm install 依赖库报错,但是我在package.json中并没有找到对应的库?

我下载一个开源项目研究,发现有peer esbuild@"^0.14.x || ^0.15.0 || ^0.16.0 || ^0.17.0" from esbuild-plugin-less@1.2.0 这样的报错:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: esbuild-plugin-less@1.2.0
npm ERR! Found: esbuild@0.12.29
npm ERR! node_modules/esbuild
npm ERR!   esbuild@"^0.12.15" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer esbuild@"^0.14.x || ^0.15.0 || ^0.16.0 || ^0.17.0" from esbuild-plugin-less@1.2.0
npm ERR! node_modules/esbuild-plugin-less
npm ERR!   esbuild-plugin-less@"^1.0.7" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: esbuild@0.17.17
npm ERR! node_modules/esbuild
npm ERR!   peer esbuild@"^0.14.x || ^0.15.0 || ^0.16.0 || ^0.17.0" from esbuild-plugin-less@1.2.0
npm ERR!   node_modules/esbuild-plugin-less
npm ERR!     esbuild-plugin-less@"^1.0.7" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/markleo/.npm/eresolve-report.txt for a full report.

但是我在package.json中并没有看到有任何的eslint的依赖库:

image.png


在package.json中没有依赖库,为何这里还有依赖冲突呢?需要如何才能解决?

阅读 2.7k
2 个回答
✓ 已被采纳

可以用npm why 包名,这样方式查是怎么引进来的

后面有提示,在命令行后面跟 --force 试下,报错不一定会出问题,能正常运行就行

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏