node重装angular-cli(ng serve 找不到ng)

创建时间:2018/11/7 15:20:10
关键字:ng serve 找不到ng ng不是内部支持的程序

ng serve 找不到ng ng不是内部支持的程序,先卸载然后按如下方式重装。
 
彻底卸载:
npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache verify
Delete the C:\Users\YOU\AppData\Roaming\npm\node_modules\@angular folder.
 
npm uninstall angular-devkit/build-angular
npm uninstall @angular-devkit/build-angular
npm cache verify
Delete the yourproject\npm\node_modules\@angular folder.
 
npm uninstall angular-cli
npm uninstall @angular/cli
npm cache verify
 
 
重装:
1.首先确认安装了node.js和npm
// 显示当前node和npm版本
$ node -v
$ npm -v
// node 版本高于6.9.3 npm版本高于3.0.0
2.全局安装typescript(可选)
$ npm install -g typescript 
 
3.安装Angular CLI
npm install -g @angular/cli@latest
npm install -g @angular-devkit/build-angular