ng serve的角度项目错误找不到模块'@ angular-devkit / core'

问题描述

我具有angular / cli的全球版本1.5.0,我已经下载了Visual Studio代码,并使用命令“ ng new projectCheckBox”创建了一个项目,然后完成了ng服务和Visual Studio代码抛出我出现以下错误

E: \ Projects \ AngularCode \ projectCheckBox> ng serve
module.js: 487
 throw err;
 ^

Error: Cannot find module '@ angular-devkit / core'
 at Function.Module._resolveFilename (module.js: 485: 15)
 at Function.Module._load (module.js: 437: 25)
 at Module.require (module.js: 513: 17)
 at require (internal / module.js: 11:18)
 at Object. <anonymous> (E: \ Projects \ AngularCode \ projectCheckBox \ node_modules \ @ angular-devkit \ schematics \ src \ tree \ virtual.js: 10:16)
 at Module._compile (module.js: 569: 30)
 at Object.Module._extensions..js (module.js: 580: 10)
 at Module.load (module.js: 503: 32)
 at tryModuleLoad (module.js: 466: 12)
 at Function.Module._load (module.js: 458: 3)

我想念什么吗?

解决方法

您是否正在使用 Node Package Manager ? 如果是这样,您可能想运行:

npm install

(用于安装所有缺少的软件包)或

npm update -g @angular/cli

((全局更新您的cli)

,

Lea是对的! 可以使用这个:

npm update -g @angular/cli

并编辑package.json更改行 “ @ angular / cli”:“ 1.5.0”, 至 “ @ angular / cli”:“ ^ 1.5.0”,

使用后:

npm update

但是命令:npm update -g @angular/cli应该足够:)。