从网上down下来 angular 代码 This version of CLI is only compatible with Angular versions ^13. 本地run报错 (已解决)
程序开发
2023-09-08 21:56:55
背景:全局已安装好了angularCli,也install完成,本以为能跑起来,结果没想到报错
按道理讲,angular版本是最新的,应该是没有问题的,但是偏偏报错。
所以先卸载了全局的angular
npm uninstall @angular/cli -g
然后清除缓存
npm cache verify // 也有些人是 npm cache clean
先查一下 angular 是否还存在
ng version // 有些人是 ng -v 或者 ng -version
如果报没找到指令,那就对了。可继续往下走。
继续安装 可以按按照自己的需求选择下面任意一个指令
npm install -g @angular/cli@latest // 该指令是 全局安装最新版本
npm install -g @angular/cli@xx.xx.xx // 该指令是 全局安装指定版本
npm install @angular/cli@~xx.xx.xx --save-dev // 该指令是 该项目安装指定版本
安装好后,查看是否安装成功
ng version // 有些人是 ng -v 或者 ng -version
像我的这个红箭头指示的位置就是报错的原因了。
继续操作 👇
升级 angular/core
ng update @angular/core
最后就可以在项目中
npm install
此处我也报了个错:
Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.
根据提示在 npm install 后面加上了 --force
执行
npm install --force
最后
npm run start
启动成功!
标签:
上一篇:
用小乌龟案例演示“话题通信、动作通信、服务通信以及参数服务器”
下一篇:
相关文章
-
无相关信息