我正在获取找不到模块'@ angular / compiler-cli'

时间:2019-01-17 04:48:59

标签: angular

我创建了一个新项目,但不允许我提供服务。它给了我“找不到模块@ angular / compiler-cli”错误。

我尝试清除缓存,从项目中删除了node_modules文件夹,但是仍然出现错误。我以前也运行过npm install -g @ angular / cli。我的package.json文件显示@ angular / compiler-cli列为devDependency。这是在删除node_modules文件夹后尝试npm安装时得到的信息:

npm WARN已弃用circular-json@0.5.9:CircularJSON仅在维护中,flatted是其后续版本。 npm ERR!在'...“ dist”:{“ shasum”:“ 25b'

附近进行解析时,JSON输入意外结束

package.json

    {
  "name": "login-page",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~7.2.0",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "core-js": "^2.5.4",
    "rxjs": "~6.3.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.12.1",
    "@angular/cli": "~7.2.1",
    "@angular/compiler-cli": "~7.2.0",
    "@angular/language-service": "~7.2.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.2.2"
  }
}

1 个答案:

答案 0 :(得分:0)

一段时间后,我回去尝试了以前提供的建议,终于成功了。我最终删除了/ node_modules / @ angular / compiler-cli中的package-lock.json文件。不确定100%是否与它有任何关系,但是先安装了npm,然后进行了ng服务,对我有用。谢谢!