• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

NPM 学习笔记 因为版本冲突,angular安装失败的解决方案

武飞扬头像
weixin_40731298
帮助1

 npm i

npm ERR! code ERESOLVE

npm ERR! ERESOLVE could not resolve

npm ERR!

npm ERR! While resolving: @angular-devkit/build-angular@12.0.5

npm ERR! Found: tslint@5.15.0

npm ERR! node_modules/tslint

npm ERR!   dev tslint@"5.15.0" from the root project

npm ERR!

npm ERR! Could not resolve dependency:

npm ERR! peerOptional tslint@"^6.1.0" from @angular-devkit/build-angular@12.0.5 

npm ERR! node_modules/@angular-devkit/build-angular

npm ERR!   dev @angular-devkit/build-angular@"~12.0.0" from the root project    

npm ERR!

npm ERR! Conflicting peer dependency: tslint@6.1.3

npm ERR! node_modules/tslint

npm ERR!   peerOptional tslint@"^6.1.0" from @angular-devkit/build-angular@12.0.5

npm ERR!   node_modules/@angular-devkit/build-angular

npm ERR!     dev @angular-devkit/build-angular@"~12.0.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!

学新通因为版本冲突,所以angular安装失败,所以用npm install -g @angular/cli@12.0.0    全局安装angular 特定的版本12.0.0  ,安装成功以后用 npm install --save --legacy-peer-deps     安装npm,问题就解决了。

这个是我再解决这个问题的过程中用到的命令。

Nodejs版本16
cmd                
npm -v         #查看npm的版本
node -v        #查看nodejs的版本
npm config set proxy=http://账号:密码@服务器名:端口号http://账号:密码@
npm config set https-proxy=http://账号:密码@服务器名:端口号@

npm config get cache   #详情参照网页:https://newsn.net/say/npm-cache.html
npm cache clean          #清除缓存#详情参照网页:https://newsn.net/say/npm-cache.html
npm cache clean -f       #强制清除缓存#详情参照网页:https://newsn.net/say/npm-cache.html
npm install -g @angular/cli@12.0.0   #全局安装angular 特定的版本12.0.0
npm install --save --legacy-peer-deps     #强制安装npm #只是在系统部署,或者有新的安装包需要安装的时候执行
ng serve              #用angular启动程序#


注:8若报此错误C:\Users\xxx\AppData\Roaming\npm\ng.ps1
①win10系统搜索框输入Windows PowerShell以管理员身份运行
②打开之后输入set-ExecutionPolicy RemoteSigned
③更改权限为A(一定要选择A)
④通过get-ExecutionPolicy 查看当前的状态
⑤最后再次运行项目

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgagjia
系列文章
更多 icon
同类精品
更多 icon
继续加载