2017-08-08 51 views
0

這裏我嘗試升級我Angular2到Angular4我得到錯誤的嚴重性代碼說明項目文件的線路抑制狀態 錯誤生成:初始值設定不準在周圍環境 包.js打字稿錯誤:初始化器不允許在環境方面

{ 
    "name": "angular-quickstart", 
    "version": "1.0.0", 
    "scripts": { 
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ", 
    "lite": "lite-server", 
    "postinstall": "typings install", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "typings": "typings" 
    }, 
    "license": "ISC", 
    "dependencies": { 
    "@angular/common": "4.0.0", 
    "@angular/compiler": "4.0.0", 
    "@angular/core": "4.0.0", 
    "@angular/forms": "4.0.0", 
    "@angular/http": "4.0.0", 
    "@angular/platform-browser": "4.0.0", 
    "@angular/platform-browser-dynamic": "4.0.0", 
    "@angular/router": "4.0.0", 
    "@angular/upgrade": "4.0.0", 
    "core-js": "^2.4.1", 
    "reflect-metadata": "^0.1.3", 
    "rxjs": "^5.0.1", 
    "systemjs": "0.19.27", 
    "zone.js": "^0.8.4", 
    "bootstrap": "^3.3.6" 
    }, 
    "devDependencies": { 
    "concurrently": "^2.2.0", 
    "lite-server": "^2.2.2", 
    "typescript": "^2.0.2", 
    "typings": "^1.3.2" 
    } 
} 
+0

它與'package.json'沒有關係,請將代碼粘貼到出現此錯誤的位置。 – Faisal

+0

儘管拋出錯誤的代碼是理解問題的「必須」,但我不會說package.json與錯誤無關。這可能是一個版本問題。但當然,這可能是別的。 – Pac0

回答

0

檢查您的手稿版本。可能你的打字稿已過時。使用舊的node_modules時也可能發生同樣的問題。請嘗試使用更新的節點程序包

+0

我正在使用node_8.2.1 –

+1

嘗試將您的「打字稿」:「^ 2.0.2」設置爲最新。 –

0

嘗試npm install -g typescript @ latest在終端中獲取最新的打印機獲取安裝。