我的Angular2项目突然停止了工作

时间:2016-08-22 15:50:29

标签: angular typescript

我有一个Angular2项目,我正在使用Ubuntu 16进行部署和使用,但今天它已经停止工作了,

它给出的错误是它无法加载/ angular2 / core模块。

请帮帮我

package.json
============
{
  "name": "myproj",
  "version": "1.0.0",
  "scripts": {
    "start": "npm run lite",
    "lite": "lite-server"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common": "2.0.0-rc.5",
    "@angular/compiler": "2.0.0-rc.5",
    "@angular/core": "2.0.0-rc.5",
    "@angular/forms": "0.3.0",
    "@angular/http": "2.0.0-rc.5",
    "@angular/platform-browser": "2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "2.0.0-rc.5",
    "@angular/router": "3.0.0-rc.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.5",

    "core-js": "^2.4.0",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "0.6.12",

    "angular2-in-memory-web-api": "0.0.15",
    "bootstrap": "^3.3.6"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0"
  }
}

2 个答案:

答案 0 :(得分:0)

我会做几件事。首先,重新安装@angular。其次,如果这不起作用,请确保您的systemJs设置正确。

答案 1 :(得分:0)

然后你在某个地方尝试import {...} from 'angular2/core'。它是' @ angular / core'已经有一段时间了。尝试在整个项目中搜索angular2/core

您的package.json包含"angular2-in-memory-web-api": "0.0.15"作为依赖项。它从'angular2/core'这里https://github.com/wardbell/a2-in-memory-web-api/blob/0.1.15/src/in-memory-backend.service.ts导入。

尝试使用angular2-in-memory-web-api

更新npm install angular2-in-memory-web-api --save

编辑:即使angular2-in-memory-web-api的最新版本使用"angular2": "2.0.0-beta.17"。您需要降级角度或摆脱该包裹。