【问题标题】:Angular project error with ng serve Cannot find module '@ angular-devkit / core'ng serve 的 Angular 项目错误找不到模块'@ angular-devkit / core'
【发布时间】:2020-12-28 01:29:20
【问题描述】:

我有 angular / cli 的全球版本 1.5.0,我已经下载了 Visual Studio 代码并使用命令“ng new projectCheckBox”创建了一个项目,然后我完成了一次 ng serve 和 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)

我错过了什么?

【问题讨论】:

标签: angular visual-studio-code angular-cli


【解决方案1】:

您是否在使用 节点包管理器? 如果是这样,您可能想运行:

npm install

(安装所有缺少的包)或

npm update -g @angular/cli

(更新您的 cli(全局))

【讨论】:

    【解决方案2】:

    李是对的! 可以用这个:

    npm update -g @angular/cli
    

    并编辑您的 package.json 更改行 "@angular/cli": "1.5.0", 到 "@angular/cli": "^1.5.0",

    使用后:

    npm update
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-14
      • 2018-07-01
      • 1970-01-01
      • 2021-05-24
      • 2018-10-28
      • 1970-01-01
      • 2021-08-10
      相关资源
      最近更新 更多