2016-03-17 127 views
4

我有節點v4.4.0和npm v2.14.20安裝在OS X(埃爾卡皮坦)。npm ERR!在npm安裝步驟Angular 2快速啓動

我遵循在Angular 2官方網站上提供的5 Min Quickstart - ts頁面上描述的步驟。

但是當我執行npm install時遇到以下錯誤。

npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements! 
npm ERR! peerinvalid Peer [email protected] wants [email protected]^0.33.3 

爲了能夠隔離問題,這是我所做的。

  1. 創建一個空的項目文件夾。
  2. 在空文件夾中,我執行了空值npm init以生成空的package.json
  3. 我已將下列依賴項添加到我的package.json中。

    "dependencies": { 
        "angular2": "2.0.0-beta.9", 
        "es6-shim": "^0.35.0" 
    } 
    
  4. 我執行npm install和觀察上述相同的錯誤。

這裏面的/node_modules/angular2

"peerDependencies": { 
    "es6-promise": "^3.0.2", 
    "es6-shim": "^0.33.3", 
    "reflect-metadata": "0.1.2", 
    "rxjs": "5.0.0-beta.2", 
    "zone.js": "0.5.15" 
} 

package.jsonpeerDependencies鑑於ES6,墊片等依賴性^0.33.3版本要求,應不ES6-墊片安裝罰款0.35.0版本?我沒有看到什麼問題?

回答

3

試試這個版本的package.json,應該這樣做

{ 
    "name": "angular2-quickstart", 
    "version": "1.0.0", 
    "scripts": { 
    "start": "concurrently \"npm run tsc:w\" \"npm run lite\" ", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "lite": "lite-server", 
    "typings": "typings", 
    "postinstall": "typings install" 
    }, 
    "license": "ISC", 
    "dependencies": { 
    "angular2": "2.0.0-beta.9", 
    "systemjs": "0.19.24", 
    "es6-promise": "^3.0.2", 
    "es6-shim": "^0.33.3", 
    "reflect-metadata": "0.1.2", 
    "rxjs": "5.0.0-beta.2", 
    "zone.js": "0.5.15" 
    }, 
    "devDependencies": { 
    "concurrently": "^2.0.0", 
    "lite-server": "^2.1.0", 
    "typescript": "^1.8.7", 
    "typings":"^0.7.5" 
    } 
} 
+1

小心解釋這是如何不同或爲什麼它的作品? – aboveyou00

+0

@ aboveyou00這個package.json只是使用以前版本的es6-shim(0.33.3)。最後的錯誤信息使得這個調用變得簡單:'npm ERR!peerinvalid Peer [email protected]需要es6-shim @^0.33.3' – Mehdi

0

的package.json

{ 
    "name": "angular2-quickstart", 
    "version": "1.0.0", 
    "scripts": { 
    "start": "concurrently \"npm run tsc:w\" \"npm run lite\" ", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "lite": "lite-server", 
    "typings": "typings", 
    "postinstall": "typings install" 
    }, 
    "license": "ISC", 
    "dependencies": { 
    "angular2": "2.0.0-beta.10", 
    "systemjs": "0.19.24", 
    "es6-promise": "^3.0.2", 
    "es6-shim": "^0.35.0", 
    "reflect-metadata": "0.1.2", 
    "rxjs": "5.0.0-beta.2", 
    "zone.js": "^0.6.4" 
    }, 
    "devDependencies": { 
    "concurrently": "^2.0.0", 
    "lite-server": "^2.1.0", 
    "typescript": "^1.8.7", 
    "typings":"^0.7.5", 
    "grunt"    : "^0.4.5", 
    "grunt-contrib-clean" : "^1.0.0", 
    "grunt-contrib-concat" : "^1.0.0", 
    "grunt-contrib-sass" : "^0.9.2", 
    "grunt-contrib-watch" : "^0.6.1" 
    } 
} 

node_modules/angular2 /的package.json

"peerDependencies": { 
    "es6-promise": "^3.0.2", 
    "es6-shim": "^0.35.0", 
    "reflect-metadata": "0.1.2", 
    "rxjs": "5.0.0-beta.2", 
    "zone.js": "^0.6.4" 
    }, 

不知道是否所有的我上面所做的完全正確。 但它的工作到目前爲止

我認爲最近的更新(https://github.com/angular/quickstart/blob/master/package.json)是造成這個問題。

編輯:基本上變化是:

  • 「angular2」: 「2.0.0-beta.10」
  • 「ES6-墊片」: 「^ 0.35.0」,
  • 「 zone.js「:」^ 0.6.4「
7

我有同樣的問題,除了我有Windows10。 我通過將我的Node.js從4.4.1 LTS升級到5.9.0穩定版解決了這個問題。