2016-08-22 111 views
1

我有一個Angular2項目這點我是部署和Ubuntu的16費時,但是今天它已停止工作,我Angular2項目突然停止工作

它給人的錯誤在於,它無法加載/ angular2 /核心模塊。

請幫我

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" 
    } 
} 

回答

0

我會做幾件事情。首先,重新安裝@angular。其次,如果這不起作用,請確保您的systemJs設置是正確的。

+0

我是Angular的新手,如何重新安裝@angular,會不會安裝npm幫助? –

+0

將目錄更改爲包含package.json文件的項目目錄,然後鍵入npm install ...這將重新安裝所有軟件包並更新任何依賴項。如果問題是一個損壞的文件,這應該修復它。 –

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

嘗試用npm install angular2-in-memory-web-api --save

編輯更新angular2-in-memory-web-api:即使是angular2-in-memory-web-api是最新versino使用"angular2": "2.0.0-beta.17"。您需要降級角度或擺脫該包。

+0

這對我有用,謝謝 –

+0

很高興我能幫到你。你介意把這個標記爲答案嗎? – j2L4e