vue-使用npm下载包时报错解决办法:--legacy-peer-deps

这篇具有很好参考价值的文章主要介绍了vue-使用npm下载包时报错解决办法:--legacy-peer-deps。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

使用npm安装包时报下面的错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @vue/eslint-config-standard@6.1.0
npm ERR! Found: eslint-plugin-vue@8.7.1
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR!   dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: eslint-plugin-vue@7.20.0
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     dev @vue/eslint-config-standard@"^6.1.0" 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! 
npm ERR! For a full report see:

出现的原因:

为什么会出现上述错误:
是因为npm版本过高的原因,高于7之后要求会更严格;
npm -V可以查看npm的版本
--legacy-peer-deps 标志  是在v7中引入的,目的是绕过peerDependency自动安装;它告诉 NPM 忽略项目中引入的各个modules之间的相同modules但不同版本的问题并继续安装。

解决办法:文章来源地址https://www.toymoban.com/news/detail-550128.html

在命令后面加上: --legacy-peer-deps
如:
npm i less less-loader -D --legacy-peer-deps
npm i axios --legacy-peer-deps

到了这里,关于vue-使用npm下载包时报错解决办法:--legacy-peer-deps的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • vue-element-admin - 克隆项目后 npm install 装包时报错:code 128 An unknown git error occurred(完美解决方案,100% 解决!)

    网上大部分方案都不行,请仔细对比如下报错信息,如果我们一样的话,本文的方案 100% 解决! 克隆 vue-element-admin 项目时,npm install 装包时,出现了如下报错。 npm ERR! code 128 npm ERR! An unknown git error occurred npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/nhn/raphael.git n

    2024年02月10日
    浏览(54)
  • idea中不能使用npm命令的解决办法

    1.问题 在idea的Terminal命令窗口里面输入npm -v的命令时,报’npm’不是内部或外部命令,也不是可运行的程序或批处理文件。 2.原因 这是因为idea的Terminal里面配的是git,而不是我们本机的cmd,这时我们只需要把git改为本机的cmd就好npm 3.解决办法 点击IDEA左上角的File,点击setting

    2024年02月04日
    浏览(32)
  • 使用git拉取项目时报错fatal: Authentication failed for ‘XXX‘ 解决办法

    错误截图 :   问题原因 : 没有相关链接的权限。这个问题通常出现在拉取没有认证过的新网站的代码时,如初始配置的为gitee(码云),本次拉取github中的代码,可能会出现这个问题,我们这时候就需要进行一个认证操作。 解决方法 : 方法一: git小乌龟中,打开小乌龟设

    2024年02月12日
    浏览(56)
  • 解决npm命令安装依赖时报错

    今天在拉完项目,执行 npm install 命令的时候,一直报错,解决了好久,终于解决啦。报错信息如下: ​ npm ERR! C:Program FilesGitcmdgit.EXE ls-remote -h -t git://github.com/adobe-webplatform/eve.git 截图如下: npm ERR! Error while executing: npm ERR! C:Program FilesGitcmdgit.EXE ls-remote -h -t git://github.co

    2023年04月10日
    浏览(27)
  • windows下MSYS、MinGW编译环境使用网络API时报错:undefined reference to `inet_pton‘解决办法

    mingw-gcc环境使用网络需要加上库 -lws2_32。 如果是使用的是Qt Creator那么需要在.pro文件中加入一行: win32:LIBS += -lws2_32 。 当在项目中使用 inet_pton、inet_pton、inet_ntop、inet_ntop 等ip转换函数时会报未定义的错误,这是因为在windows系统下这些函数的定义在头文件 winsock2.h 和 ws2tcpip

    2024年02月11日
    浏览(30)
  • 解决安装依赖时报错:npm ERR! code ERESOLVE

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到网站,这篇文章男女通用,看懂了就去分享给你的码吧。 在使用 npm 安装项目依赖时,有时会遇到错误信息 “npm ERR! code ERESOLVE”,该错误通常发生在依赖版本冲突或者依

    2024年02月15日
    浏览(30)
  • npm install指令安装东西时报network错误解决方案

    报错截图: 报错代码: 解决方案: ①进行代理设置为false,如下命令 ②npm缓存清理,如下命令 ③再次执行npm install命令即可解决此问题

    2024年02月12日
    浏览(45)
  • 解决npm install时报错Could not resolve dependency

    最近在新的项目使用npm install时发现报错: npm WARN cli npm v9.6.4 does not support Node.js v15.14.0. This version of npm supports the following node versions: `^14.17.0 || ^16.13.0 || =18.0.0`. You can find the latest version at https://nodejs.org/. npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR!  npm ERR! While resolving:

    2024年02月08日
    浏览(38)
  • 解决执行npm(或pnpm)时报:证书过期 certificate has expired问题

    项目执行 pnpm install 初始化时报 reason: certificate has expired 错误。 解决方案

    2024年01月23日
    浏览(40)
  • vue3+vite项目构建时报错npm ERR! code EPERMnpm ERR! syscall mkdir...

    vscode终端中输入npm create vite@latest vueviteproject1 -- --vue命令后报错 具体报错如下:   PS D:project npm create vite@latest vueviteproject1 -- --vue   npm ERR! code EPERM npm ERR! syscall mkdir npm ERR! path D:nodenode_cache_cacache npm ERR! errno -4048 npm ERR! Error: EPERM: operation not permitted, mkdir \\\'D:nodenode_cache_cacac

    2024年01月16日
    浏览(28)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包