2017-08-01 96 views
2

我試圖用NG內部版本我angular2應用程序,但我得到以下錯誤: -的「@角/編譯器(CLI)」包安裝不正確的錯誤

The "@angular/compiler-cli" package was not properly installed. Error: TypeError: Object prototype may only be an Object or null: undefined 
Error: The "@angular/compiler-cli" package was not properly installed. Error: TypeError: Object prototype may only be an Object or null: undefined 
    at Object.<anonymous> (C:\Official\UI\angular3\node_modules\@ngtools\webpack\src\index.js:14:11) 
    at Module._compile (module.js:571:32) 
    at Object.Module._extensions..js (module.js:580:10) 
    at Module.load (module.js:488:32) 
    at tryModuleLoad (module.js:447:12) 
    at Function.Module._load (module.js:439:3) 
    at Module.require (module.js:498:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (C:\Official\UI\angular3\node_modules\@angular\cli\tasks\eject.js:10:19) 
    at Module._compile (module.js:571:32) 
    at Object.Module._extensions..js (module.js:580:10) 
    at Module.load (module.js:488:32) 
    at tryModuleLoad (module.js:447:12) 
    at Function.Module._load (module.js:439:3) 
    at Module.require (module.js:498:17) 
    at require (internal/module.js:20:19) 

我甚至試圖刪除現有node_modules並再次安裝,但它不起作用。

有什麼想法?這裏是我的package.json: -

"dependencies": { 
    "@angular/common": "2.4.6", 
    "@angular/compiler": "2.4.6", 
    "@angular/core": "2.4.6", 
    "@angular/forms": "2.4.6", 
    "@angular/http": "2.4.6", 
    "@angular/platform-browser": "2.4.6", 
    "@angular/platform-browser-dynamic": "2.4.6", 
    "@angular/router": "3.0.0-rc.1", 
    "@angular/router-deprecated": "2.0.0-rc.2", 
    "angular": "^1.6.4", 
    "angular2": "^2.0.0-beta.21", 
    "angular2-in-memory-web-api": "0.0.15", 
    "bootstrap": "^3.3.6", 
    "core-js": "^2.4.0", 
    "reflect-metadata": "^0.1.3", 
    "rxjs": "^5.0.0-beta.6", 
    "systemjs": "^0.19.27", 
    "zone.js": "^0.6.12", 
    "ng2-bootstrap": "^1.0.17", 
    "ng2-translate": "2.4.1", 
    "typescript": "~2.2.0" 
    }, 
    "devDependencies": { 
    "@angular/cli": "^1.2.6", 
    "@angular/compiler-cli": "^4.3.2", 
    "concurrently": "^2.2.0", 
    "lite-server": "^2.3.0", 
    "typescript": "~2.2.0" 
    } 
+0

我的情況下更新的問題,我的[角CLI(https://github.com/ angular/angular-cli#updating-angular-cli),http://itechiesol.blogspot.in/2017/07/angular-compiler-cli-package-was-not.html – k11k2

+0

我試過這個,但還是一樣的錯誤。 – NJin

+0

你執行了這個命令'npm install'嗎? – k11k2

回答

2

您可以卸載,清理緩存和更新最新版本的角

npm uninstall -g angular-cli @angular/cli 
npm cache clean 
npm install -g @angular/[email protected] 

閱讀this瞭解更多信息

+0

我已經試過這個,但仍然是同樣的錯誤。 – NJin

0

你只需要安裝npm

npm install 

沒有與版本

"@angular/cli": "1.0.0-rc.4" 

嘗試安裝舊的一個

"@angular/cli": "1.0.0-rc.2"