NPM 学习笔记 因为版本冲突,angular安装失败的解决方案
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
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
excel打印预览压线压字怎么办
PHP中文网 06-22 -
怎样阻止微信小程序自动打开
PHP中文网 06-13 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01