100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 从网上down下来 angular 代码 This version of CLI is only compatible wit

从网上down下来 angular 代码 This version of CLI is only compatible wit

时间:2022-01-30 02:26:52

相关推荐

从网上down下来 angular 代码 This version of CLI is only compatible wit

背景:全局已安装好了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

启动成功!

从网上down下来 angular 代码 This version of CLI is only compatible with Angular versions ^13. 本地run报错 (已解决)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。