npm加载的包版本(angularfire2)与package.json中指定的版本不同

时间:2017-02-18 10:36:37

标签: npm angularfire2

我正在尝试使用 angularfire2 包为应用创建新的开发环境,从存储库下载源代码。

package.json 文件指向 angularfire2 2.0.0-beta.6 版本,如下面的代码段

{
  "name": "blah blah",
  "author": "blah blah",
  ...
  "dependencies": {
    ....
    "angularfire2": "^2.0.0-beta.6",
    ...
  }
  .....
}

run npm安装下载我需要的所有软件包。

不幸的是,在 angularfire2 的情况下,下载的内容似乎是该软件包的不同版本(可能是 2.0.0-beta.8 )版本 2.0.0-beta.6 的更改。

这怎么可能?

angularfire2 目录中的 package.json 文件(在 node_modules 下)是以下

{
  "_args": [
    [
      {
        "raw": "angularfire2@^2.0.0-beta.6",
        "scope": null,
        "escapedName": "angularfire2",
        "name": "angularfire2",
        "rawSpec": "^2.0.0-beta.6",
        "spec": ">=2.0.0-beta.6 <3.0.0",
        "type": "range"
      },
      "/Users/penrico/ThoughWorks/code/angular/castella"
    ]
  ],
  "_from": "angularfire2@>=2.0.0-beta.6 <3.0.0",
  "_id": "angularfire2@2.0.0-beta.8",
  "_inCache": true,
  "_location": "/angularfire2",
  "_nodeVersion": "6.9.1",
  "_npmOperationalInternal": {
    "host": "packages-18-east.internal.npmjs.com",
    "tmp": "tmp/angularfire2-2.0.0-beta.8.tgz_1487250058126_0.7350442344322801"
  },
  "_npmUser": {
    "name": "davideast",
    "email": "dceast@gmail.com"
  },
  "_npmVersion": "3.10.8",
  "_phantomChildren": {},
  "_requested": {
    "raw": "angularfire2@^2.0.0-beta.6",
    "scope": null,
    "escapedName": "angularfire2",
    "name": "angularfire2",
    "rawSpec": "^2.0.0-beta.6",
    "spec": ">=2.0.0-beta.6 <3.0.0",
    "type": "range"
  },
  "_requiredBy": [
    "/"
  ],
  "_resolved": "https://registry.npmjs.org/angularfire2/-/angularfire2-2.0.0-beta.8.tgz",
  "_shasum": "8ec172ff17448c3ccdb79e9c6179da556ff05e1b",
  "_shrinkwrap": null,
  "_spec": "angularfire2@^2.0.0-beta.6",
  "_where": "/Users/penrico/ThoughWorks/code/angular/castella",
  "author": {
    "name": "jeffbcross,davideast"
  },
  "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": {
    "@angular/compiler-cli": "^2.0.0",
    "@angular/platform-server": "^2.0.0-rc.5",
    "@types/jasmine": "^2.5.36",
    "@types/request": "0.0.30",
    "concurrently": "^2.2.0",
    "conventional-changelog-cli": "^1.2.0",
    "es6-module-loader": "^0.17.10",
    "es6-shim": "^0.35.0",
    "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",
    "ncp": "^2.0.0",
    "parse5": "^1.3.2",
    "protractor": "3.0.0",
    "reflect-metadata": "0.1.2",
    "rimraf": "^2.5.4",
    "rollup": "^0.35.11",
    "rollup-watch": "^2.5.0",
    "systemjs": "^0.19.16",
    "systemjs-builder": "^0.15.7",
    "traceur": "0.0.96",
    "typedoc": "github:jeffbcross/typedoc",
    "typescript": "^2.0.2",
    "zone.js": "^0.7.2"
  },
  "directories": {},
  "dist": {
    "shasum": "8ec172ff17448c3ccdb79e9c6179da556ff05e1b",
    "tarball": "https://registry.npmjs.org/angularfire2/-/angularfire2-2.0.0-beta.8.tgz"
  },
  "homepage": "https://github.com/angular/angularfire2#readme",
  "keywords": [
    "angular2",
    "angular",
    "firebase"
  ],
  "license": "MIT",
  "main": "bundles/angularfire2.umd.js",
  "maintainers": [
    {
      "name": "angularcore",
      "email": "angular-core+npm@google.com"
    },
    {
      "name": "davideast",
      "email": "dceast@gmail.com"
    },
    {
      "name": "jeffbcross",
      "email": "middlefloor@gmail.com"
    }
  ],
  "module": "index.js",
  "name": "angularfire2",
  "optionalDependencies": {},
  "peerDependencies": {
    "@angular/common": "^2.0.0",
    "@angular/compiler": "^2.0.0",
    "@angular/core": "^2.0.0",
    "@angular/platform-browser": "^2.0.0",
    "@angular/platform-browser-dynamic": "^2.0.0",
    "firebase": "^3.0.0",
    "rxjs": "^5.0.1"
  },
  "readme": "ERROR: No README data found!",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/angular/angularfire2.git"
  },
  "scripts": {},
  "typings": "index.d.ts",
  "version": "2.0.0-beta.8"
}

第一个突破性的变化(只是为了让我的理论证明这是一个不同版本的包)是没有更多的 FirebaseAuth (它似乎被 AngularFireAuth )。

1 个答案:

答案 0 :(得分:1)

它正在安装更高版本,因为该版本满足您在package.json文件中指定的caret range

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

如果您需要特定版本,请删除插入符号:

"angularfire2": "2.0.0-beta.6"

查看spec下的_requested - 已在package.json node_modules/angularfire2文件中的"spec": ">=2.0.0-beta.6 <3.0.0", 下填写 - 您可以看到您指定的插入符号范围是相当于:

my_field_1