Angular 2找不到'@ angular / common / http'模块

时间:2018-04-16 22:07:34

标签: angular

我正在尝试使用以下行导入HttpRequest,HttpHandler,HttpEvent,HttpInterceptor:

  

从{HttpRequest,HttpHandler,HttpEvent,HttpInterceptor}导入   '@角/普通/ HTTP';

但是我一直得到同样的错误:

  

找不到'@ angular / common / http'模块

的package.json:

{
  "name": "coreui",
  "version": "1.0.0-alpha.4",
  "description": "Open Source Bootstrap Admin Template",
  "author": "",
  "url": "http://coreui.io",
  "copyright": "Copyright 2017 creativeLabs Łukasz Holeczek",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "2.4.9",
    "@angular/compiler": "2.4.9",
    "@angular/core": "2.4.9",
    "@angular/forms": "2.4.9",
    "@angular/http": "2.4.9",
    "@angular/platform-browser": "2.4.9",
    "@angular/platform-browser-dynamic": "2.4.9",
    "@angular/router": "3.4.9",
    "@angular/upgrade": "2.4.9",
    "chart.js": "2.5.0",
    "core-js": "2.4.1",
    "moment": "2.17.1",
    "ng2-bootstrap": "1.4.0",
    "ng2-charts": "1.5.0",
    "promise-polyfill": "7.1.0",
    "rxjs": "5.2.0",
    "ts-helpers": "1.1.2",
    "zone.js": "0.7.2"
  },
  "devDependencies": {
    "@angular/cli": "^1.7.3",
    "@angular/compiler-cli": "2.4.9",
    "@types/jasmine": "2.5.45",
    "@types/node": "7.0.8",
    "codelyzer": "2.0.1",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "3.2.0",
    "karma": "1.5.0",
    "karma-chrome-launcher": "2.0.0",
    "karma-cli": "1.0.1",
    "karma-coverage-istanbul-reporter": "0.3.0",
    "karma-jasmine": "1.1.0",
    "karma-jasmine-html-reporter": "0.2.2",
    "protractor": "5.1.1",
    "ts-node": "2.1.0",
    "tslint": "4.5.1",
    "typescript": "2.2.1"
  },
  "main": "karma.conf.js"
}

我该如何解决这个问题?

0 个答案:

没有答案