0

我有以下内容package.json

{
  "name": "bignibou-client",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "postinstall": "typings install",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "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",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.1",
    "angular2-moment": "^0.8.1",
    "bootstrap": "4.0.0-alpha.3",
    "es6-shim": "0.35.1",
    "moment": "^2.13.0",
    "ng2-bootstrap": "^1.0.23",
    "ng2-translate": "^2.2.2",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.27",
    "zone.js": "0.6.12"
  },
  "devDependencies": {
    "angular-cli": "1.0.0-beta.10",
    "codelyzer": "0.0.20",
    "ember-cli-inject-live-reload": "1.4.0",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "0.13.22",
    "karma-chrome-launcher": "0.2.3",
    "karma-jasmine": "0.3.8",
    "protractor": "3.3.0",
    "ts-node": "0.5.5",
    "tslint": "3.11.0",
    "typescript": "1.8.10",
    "typings": "0.8.1"
  }
}

但是,我总是以以下版本结束@ng-bootstrap/ng-bootrap1.0.0-alpha.2

尽管我已明确alpha.1指定package.json

"@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.1",

有谁知道什么可能导致NPM强制使用不同的版本?

附言

我还包括来自npm 日志的信息:

154593 silly linkStuff bignibou-client@0.0.0 has /Users/julien/Documents/projects/bignibou as its parent node_modules
154594 verbose linkBins bignibou-client@0.0.0
154595 verbose linkMans bignibou-client@0.0.0
154596 verbose rebuildBundles bignibou-client@0.0.0
154597 verbose rebuildBundles [ '.DS_Store',
154597 verbose rebuildBundles   '.bin',
154597 verbose rebuildBundles   '@angular',
154597 verbose rebuildBundles   '@ng-bootstrap',
154597 verbose rebuildBundles   'angular-cli',
154597 verbose rebuildBundles   'angular2-moment',
154597 verbose rebuildBundles   'bootstrap',
154597 verbose rebuildBundles   'codelyzer',
154597 verbose rebuildBundles   'ember-cli-inject-live-reload',
154597 verbose rebuildBundles   'es6-shim',
154597 verbose rebuildBundles   'jasmine-core',
154597 verbose rebuildBundles   'jasmine-spec-reporter',
154597 verbose rebuildBundles   'karma',
154597 verbose rebuildBundles   'karma-chrome-launcher',
154597 verbose rebuildBundles   'karma-jasmine',
154597 verbose rebuildBundles   'moment',
154597 verbose rebuildBundles   'ng2-bootstrap',
154597 verbose rebuildBundles   'ng2-translate',
154597 verbose rebuildBundles   'protractor',
154597 verbose rebuildBundles   'reflect-metadata',
154597 verbose rebuildBundles   'rxjs',
154597 verbose rebuildBundles   'systemjs',
154597 verbose rebuildBundles   'ts-node',
154597 verbose rebuildBundles   'tslint',
154597 verbose rebuildBundles   'typescript',
154597 verbose rebuildBundles   'typings',
154597 verbose rebuildBundles   'zone.js' ]
154598 info install bignibou-client@0.0.0
154599 info postinstall bignibou-client@0.0.0
154600 verbose unsafe-perm in lifecycle true
154601 info prepublish bignibou-client@0.0.0
154602 verbose validateInstall loading /Users/julien/Documents/projects/bignibou/bignibou-client/package.json for validation
154603 verbose stack Error: The package @angular/common@2.0.0-rc.5 does not satisfy its siblings' peerDependencies requirements!
154603 verbose stack     at /usr/local/lib/node_modules/npm/lib/install.js:125:32
154603 verbose stack     at /usr/local/lib/node_modules/npm/lib/install.js:268:7
154603 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-installed/read-installed.js:142:5
154603 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-installed/read-installed.js:263:14
154603 verbose stack     at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:47:24)
154603 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-installed/read-installed.js:263:14
154603 verbose stack     at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:47:24)
154603 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-installed/read-installed.js:263:14
154603 verbose stack     at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:47:24)
154603 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-installed/read-installed.js:263:14
154604 verbose cwd /Users/julien/Documents/projects/bignibou/bignibou-client
154605 error Darwin 15.5.0
154606 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
154607 error node v4.4.5
154608 error npm  v2.15.5
154609 error code EPEERINVALID
154610 error peerinvalid The package @angular/common@2.0.0-rc.5 does not satisfy its siblings' peerDependencies requirements!
154610 error peerinvalid Peer @angular/forms@0.3.0 wants @angular/common@^2.0.0-rc.5
154610 error peerinvalid Peer @angular/platform-browser@2.0.0-rc.5 wants @angular/common@^2.0.0-rc.5
154610 error peerinvalid Peer @angular/platform-browser-dynamic@2.0.0-rc.5 wants @angular/common@^2.0.0-rc.5
154610 error peerinvalid Peer @angular/router@3.0.0-rc.1 wants @angular/common@^2.0.0-rc.5
154610 error peerinvalid Peer @ng-bootstrap/ng-bootstrap@1.0.0-alpha.2 wants @angular/common@^2.0.0-rc.5
154610 error peerinvalid Peer ng2-bootstrap@1.0.24 wants @angular/common@2.0.0-rc.4
154610 error peerinvalid Peer ng2-translate@2.2.2 wants @angular/common@^2.0.0-rc.3
154611 verbose exit [ 1, true ]
4

1 回答 1

3

实际上,您指定了

所有版本都以 1 作为主要版本号(又名 1.xx),但至少是 1.0.0-alpha.1 版本

要仅获取 1.0.0-alpha.1 版本,您指定的版本应该是

1.0.0-alpha.1

没有

^

在这里试试:Semver 计算器

于 2016-08-10T14:48:25.880 回答