【angular】angular报错:Versions of @angular/compiler-cli and typescript could not be determined.

1.新电脑跑augnlar项目报错,原因是明显的,没有装angular工具.顺便把ionic工具也装了;
这里写图片描述

2.先安装我要用的ionic和cordova工具
这里写图片描述

3.报错,报错信息如下:

Versions of @angular/compiler-cli and typescript could not be determined.
The most common reason for this is a broken npm install.

Please make sure your package.json contains both @angular/compiler-cli and typescript in
devDependencies, then delete node_modules and package-lock.json (if you have one) and
run npm install again.

按照报错的建议,可能是npm没有装全,装了一部分,是残缺品,采取措施如下:
1.删除node_modules文件夹
2.如果有package-lock.json文件,删除之;
3.重新安装npm,在Terminal输入

npm install

这里写图片描述

4.ng serve –open(或者ng serve -o) ,编译成功;
这里写图片描述

猜你喜欢

转载自blog.csdn.net/river_continent/article/details/79703864