0

我的项目在 package.json 中使用 angularfire 2.0.0-beta.0 ...

"angularfire2": "^2.0.0-beta.0"

...但是在这样做之后,npm install我收到了有关 angularfire 2.0.0-beta.2 的 npm 警告:

npm WARN angularfire2@2.0.0-beta.2 requires a peer of @angular/core@2.0.0-rc.2 but none was installed.
npm WARN angularfire2@2.0.0-beta.2 requires a peer of @angular/platform-browser@2.0.0-rc.2 but none was installed.
npm WARN angularfire2@2.0.0-beta.2 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.
npm WARN angularfire2@2.0.0-beta.2 requires a peer of @angular/compiler@2.0.0-rc.2 but none was installed.
npm WARN angularfire2@2.0.0-beta.2 requires a peer of @angular/platform-browser-dynamic@2.0.0-rc.2 but none was installed.
npm WARN angularfire2@2.0.0-beta.2 requires a peer of firebase@^3.0.3 but none was installed.

我看了看,node_modules/angularfire2package.json看起来像这样(注意它提到了 2.0.0-beta.0 和 2.0.0-beta.2):

{
  "_args": [
    [
      {
        "raw": "angularfire2@^2.0.0-beta.0",
        "scope": null,
        "escapedName": "angularfire2",
        "name": "angularfire2",
        "rawSpec": "^2.0.0-beta.0",
        "spec": ">=2.0.0-beta.0 <3.0.0",
        "type": "range"
      },
      "/Users/nunoarruda/repos/zee-p3-app"
    ]
  ],
  "_from": "angularfire2@>=2.0.0-beta.0 <3.0.0",
  "_id": "angularfire2@2.0.0-beta.2",
  "_inCache": true,
  "_installable": true,
  "_location": "/angularfire2",
  "_nodeVersion": "5.10.1",
  "_npmOperationalInternal": {
    "host": "packages-16-east.internal.npmjs.com",
    "tmp": "tmp/angularfire2-2.0.0-beta.2.tgz_1466557136126_0.8304361375048757"
  },
  "_npmUser": {
    "name": "angularcore",
    "email": "angular-core+npm@google.com"
  },
  "_npmVersion": "3.8.3",
  "_phantomChildren": {},
  "_requested": {
    "raw": "angularfire2@^2.0.0-beta.0",
    "scope": null,
    "escapedName": "angularfire2",
    "name": "angularfire2",
    "rawSpec": "^2.0.0-beta.0",
    "spec": ">=2.0.0-beta.0 <3.0.0",
    "type": "range"
  },
  "_requiredBy": [
    "/"
  ],
  "_resolved": "https://registry.npmjs.org/angularfire2/-/angularfire2-2.0.0-beta.2.tgz",
  "_shasum": "1455af597a789e6da206a6eefff87851dddb11e7",
  "_shrinkwrap": null,
  "_spec": "angularfire2@^2.0.0-beta.0",
  "_where": "/Users/nunoarruda/repos/zee-p3-app",
  "author": {
    "name": "jeffbcross"
  },
  "bugs": {
    "url": "https://github.com/angular/angularfire2/issues"
  },
  "dependencies": {},
  "description": "<p align=\"center\">   <h1 align=\"center\">AngularFire2</h1>   <p align=\"center\">The official library for Firebase and Angular 2</p> </p>",
  "devDependencies": {
    "conventional-changelog-cli": "^1.2.0",
    "es6-module-loader": "^0.17.10",
    "es6-shim": "^0.35.0",
    "firebase-server": "^0.5.2",
    "gulp": "^3.9.0",
    "gulp-jasmine": "^2.2.1",
    "gulp-typescript": "^2.10.0",
    "http-server": "^0.8.5",
    "jasmine": "^2.4.1",
    "jasmine-core": "^2.4.1",
    "json": "^9.0.3",
    "karma": "^0.13.19",
    "karma-chrome-launcher": "^0.2.2",
    "karma-firefox-launcher": "^0.1.7",
    "karma-jasmine": "^0.3.6",
    "karma-mocha-reporter": "^2.0.2",
    "karma-systemjs": "^0.10.0",
    "parse5": "^1.3.2",
    "protractor": "3.0.0",
    "reflect-metadata": "0.1.2",
    "systemjs": "^0.19.16",
    "systemjs-builder": "^0.15.7",
    "traceur": "0.0.96",
    "tsd": "^0.6.5",
    "typedoc": "github:jeffbcross/typedoc",
    "typescript": "^1.8.10",
    "typings": "^0.6.2",
    "zone.js": "^0.6.6"
  },
  "directories": {},
  "dist": {
    "shasum": "1455af597a789e6da206a6eefff87851dddb11e7",
    "tarball": "https://registry.npmjs.org/angularfire2/-/angularfire2-2.0.0-beta.2.tgz"
  },
  "homepage": "https://github.com/angular/angularfire2#readme",
  "jsnext:main": "./es6/angularfire2.js",
  "keywords": [
    "angular2",
    "angular",
    "firebase"
  ],
  "license": "MIT",
  "main": "./angularfire2.js",
  "maintainers": [
    {
      "name": "angularcore",
      "email": "angular-core+npm@google.com"
    },
    {
      "name": "davideast",
      "email": "dceast@gmail.com"
    },
    {
      "name": "jeffbcross",
      "email": "middlefloor@gmail.com"
    }
  ],
  "name": "angularfire2",
  "optionalDependencies": {},
  "peerDependencies": {
    "@angular/core": "2.0.0-rc.2",
    "@angular/platform-browser": "2.0.0-rc.2",
    "@angular/common": "2.0.0-rc.2",
    "@angular/compiler": "2.0.0-rc.2",
    "@angular/platform-browser-dynamic": "2.0.0-rc.2",
    "firebase": "^3.0.3",
    "rxjs": "5.0.0-beta.6"
  },
  "readme": "ERROR: No README data found!",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/angular/angularfire2.git"
  },
  "scripts": {
    "build": "rm -rf dist; tsc",
    "build_bundle": "cp -r src angularfire2 && tsc typings/main.d.ts angularfire2.ts --rootDir . --module system -t es5 --outFile dist/bundles/angularfire2.js  --moduleResolution node --emitDecoratorMetadata --experimentalDecorators",
    "build_e2e": "rm -rf dist-test && npm run build && tsc -p test/ && cp test/e2e/firebase_object/index.html dist-test/e2e/firebase_object/ && cp test/e2e/firebase_list/index.html dist-test/e2e/firebase_list/ && cp test/e2e/auth/index.html dist-test/e2e/auth/",
    "build_npm": "rm -rf dist && tsc -p tsconfig.publish.es5.json && tsc -p tsconfig.publish.es6.json",
    "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
    "docs": "typedoc --out docs/api/ --module commonjs --mode modules --name AngularFire2 src",
    "e2e_test": "webdriver-manager update && npm run build_e2e && protractor",
    "postbuild_npm": "cp manual_typings/firebase3/firebase3.d.ts package.json README.md .npmignore dist/ && npm run rewrite_npm_package",
    "rewrite_npm_package": "node --harmony_destructuring tools/rewrite-published-package.js",
    "test": "npm run build; karma start"
  },
  "typings": "angularfire2.d.ts",
  "version": "2.0.0-beta.2"
}

关于这里的问题有什么想法吗?

使用完全相同的代码的完全相同的项目在 2 个月前运行良好。我正在使用 Node v6.3.1、npm v3.10.6 和 Mac OS X El Capitan。

4

1 回答 1

1

该版本已安装,因为您的- - 中beta.2的 semver是插入符号范围并满足该范围。package.json^2.0.0-beta.02.0.0-beta.2

您上一次执行npm installwith thatpackage.json时,版本可能2.0.0-beta.0是最新的已发布版本。

随着 的发布2.0.0-beta.2,您将安装它,因为它是满足您正在使用的 semver 范围的最新发布的包。

如果您特别想2.0.0-beta.0安装,请从范围中删除插入符号:

"angularfire2": "2.0.0-beta.0"
于 2016-08-11T07:33:53.080 回答