anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装

时间:2024-03-23 19:39:01

anjular安装以及Could not find module “@angular-devkit/build-angular”解决方法

安装anjular之前需要先安装node(百度下载安装),node中自带npm,安装完成打开cmd查看安装版本信息:

  • node -v
    anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装
  • npm -v
    anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装

安装anjular

  • npm install -g @angular/cli
    anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装

查看anjular安装

  • ng -v
    anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装

创建一个新的anjular项目

  • ng new anjular-demo
    创建过程不快不慢,耐心等待,创建完成进入项目目录 cd anjular-demo,并在此目录启动项目

  • ng serve -o
    ng serve启动项目,-o启动项目并打开浏览器
    anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装
    浏览器:
    anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装

第一次安装anjular的时候手贱提前退出了,启动项目的时候报错
Could not find module “@angular-devkit/build-angular” from “D:\anjular-Demo”.
anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装

找了解决办法 在这里不管用(anjular下载不完整),只好重新清理安装

  • 卸载:npm uninstall -g angular-cli
    anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装

  • 清理:npm cache clean
    清理失败
    anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装

  • 强制清理:npm cache clean –force
    anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装

找到anjular/cli安装目录,默认在用户\AppData\Roaming\npm\node_modules目录下@angular
anjular安装Could not find module "@angular-devkit/build-angular",卸载重新安装

删除,然后重新安装再跑项目,ok