Firebase 工具更新失败或只是报告错误版本?

Hil*_*kus 5 npm firebase firebase-tools

我正在尝试使用 npm 将 firebase-tools 更新到最新版本(6.7.1)。firebase -V不断报告旧版本(6.4.0),但我不确定它是否已更新。这是在 Ubuntu linux 下

\n\n

这是我在终端中所做的

\n\n
hili@dev:~$ npm list -g | grep fireb\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\xac firebase-tools@6.4.0\n  \xe2\x94\x9c\xe2\x94\x80\xe2\x94\xac firebase@2.4.2\nhili@dev:~$ sudo npm update -g firebase-tools\n[sudo] password for hili: \n/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js\n+ firebase-tools@6.7.1\nupdated 1 package in 15.73s\nhili@dev:~$ npm list -g | grep fireb\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\xac firebase-tools@6.4.0\n  \xe2\x94\x9c\xe2\x94\x80\xe2\x94\xac firebase@2.4.2\n
Run Code Online (Sandbox Code Playgroud)\n\n

请注意,更新后,它确实报告了新版本,但当我列出时,它仍然显示旧版本。\n我尝试调试脚本/usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js,我看到了这个

\n\n
var pkg = require("../../package.json");\n...\nlogger.debug("CLI Version:  ", pkg.version);\n
Run Code Online (Sandbox Code Playgroud)\n\n

所以我检查后/usr/local/lib/node_modules/firebase-tools/package.json看到了这个。好像是新旧版本的混合体

\n\n
{\n  "_from": "firebase-tools@6.7.1",\n  "_id": "firebase-tools@6.7.1",\n  "_inBundle": false,\n  "_integrity": "sha512-8JZ2QA1gylgmlGNULrhTtkk5iS+OumCoJEgK+RNLt/ji1hSxzZehWCb13jHtqCRNRz+Kt+uwsrmExbhsNNqiBw==",\n  "_location": "/firebase-tools",\n  "_phantomChildren": {},\n  "_requested": {\n    "type": "version",\n    "registry": true,\n    "raw": "firebase-tools@6.7.1",\n    "name": "firebase-tools",\n    "escapedName": "firebase-tools",\n    "rawSpec": "6.7.1",\n    "saveSpec": null,\n    "fetchSpec": "6.7.1"\n  },\n  "_requiredBy": [\n    "#USER",\n    "/"\n  ],\n  "_resolved": "https://registry.npmjs.org/firebase-tools/-/firebase-tools-6.7.1.tgz",\n  "_shasum": "c80ddc9cfd6ca6611b50e3e656f8bee30621c6f3",\n  "_spec": "firebase-tools@6.7.1",\n  "_where": "/home/hili",\n  "author": {\n    "name": "Firebase",\n    "url": "https://firebase.google.com/"\n  },\n  "bin": {\n    "firebase": "./lib/bin/firebase.js"\n  },\n  "bugs": {\n    "url": "https://github.com/firebase/firebase-tools/issues"\n  },\n  "bundleDependencies": false,\n  "dependencies": {\n    "@google-cloud/functions-emulator": "^1.0.0-beta.5",\n    "JSONStream": "^1.2.1",\n    "archiver": "^2.1.1",\n    "cjson": "^0.3.1",\n    "cli-color": "^1.2.0",\n    "cli-table": "^0.3.1",\n    "commander": "^2.8.1",\n    "configstore": "^1.2.0",\n    "cross-env": "^5.1.3",\n    "cross-spawn": "^4.0.0",\n    "csv-streamify": "^3.0.4",\n    "didyoumean": "^1.2.1",\n    "es6-set": "^0.1.4",\n    "exit-code": "^1.0.2",\n    "filesize": "^3.1.3",\n    "firebase": "2.x.x",\n    "fs-extra": "^0.23.1",\n    "glob": "^7.1.2",\n    "google-auto-auth": "^0.7.2",\n    "inquirer": "^0.12.0",\n    "is": "^3.2.1",\n    "jsonschema": "^1.0.2",\n    "jsonwebtoken": "^8.2.1",\n    "lodash": "^4.17.10",\n    "minimatch": "^3.0.4",\n    "opn": "^5.3.0",\n    "ora": "0.2.3",\n    "portfinder": "^1.0.13",\n    "progress": "^2.0.0",\n    "request": "^2.87.0",\n    "semver": "^5.0.3",\n    "superstatic": "^6.0.1",\n    "tar": "^4.3.0",\n    "tmp": "0.0.33",\n    "universal-analytics": "^0.4.16",\n    "update-notifier": "^2.5.0",\n    "user-home": "^2.0.0",\n    "uuid": "^3.0.0",\n    "winston": "^1.0.1"\n  },\n  "deprecated": false,\n  "description": "Command-Line Interface for Firebase",\n  "devDependencies": {\n    "@types/chai": "^4.1.6",\n    "@types/chai-as-promised": "^7.1.0",\n    "@types/cli-color": "^0.3.29",\n    "@types/express": "^4.16.0",\n    "@types/glob": "^7.1.1",\n    "@types/lodash": "^4.14.118",\n    "@types/mocha": "^5.2.5",\n    "@types/nock": "^9.3.0",\n    "@types/node": "^10.12.0",\n    "@types/opn": "~5.1.0",\n    "@types/request": "^2.48.1",\n    "@types/sinon": "^5.0.5",\n    "@types/supertest": "^2.0.6",\n    "chai": "^4.2.0",\n    "chai-as-promised": "^7.1.1",\n    "coveralls": "^3.0.1",\n    "eslint": "^5.7.0",\n    "eslint-plugin-prettier": "^3.0.0",\n    "express": "^4.16.4",\n    "mocha": "^5.0.5",\n    "nock": "^9.3.3",\n    "nyc": "^13.3.0",\n    "prettier": "1.14.3",\n    "sinon": "^6.3.4",\n    "sinon-chai": "^3.2.0",\n    "source-map-support": "^0.5.9",\n    "supertest": "^3.3.0",\n    "ts-node": "^7.0.1",\n    "tslint": "^5.11.0",\n    "tslint-no-unused-expression-chai": "^0.1.4",\n    "tslint-plugin-prettier": "^2.0.0",\n    "typescript": "^3.1.3"\n  },\n  "engineStrict": true,\n  "engines": {\n    "node": ">= 6.0.0"\n  },\n  "files": [\n    "lib",\n    "templates"\n  ],\n  "homepage": "https://github.com/firebase/firebase-tools",\n  "keywords": [\n    "cdn",\n    "cli",\n    "ssl",\n    "cloud",\n    "hosting",\n    "firebase",\n    "realtime",\n    "websockets",\n    "synchronization"\n  ],\n  "license": "MIT",\n  "main": "./lib/index.js",\n  "name": "firebase-tools",\n  "nyc": {\n    "require": [\n      "ts-node/register"\n    ],\n    "extension": [\n      ".js",\n      ".ts"\n    ],\n    "exclude": [\n      "src/test/**/*"\n    ]\n  },\n  "optionalDependencies": {\n    "@google-cloud/functions-emulator": "^1.0.0-beta.5"\n  },\n  "preferGlobal": true,\n  "repository": {\n    "type": "git",\n    "url": "git+https://github.com/firebase/firebase-tools.git"\n  },\n  "scripts": {\n    "build": "tsc",\n    "build:watch": "tsc --watch",\n    "clean": "rm -rf lib",\n    "format": "prettier --write \'src/**/*.{js,ts}\'",\n    "lint": "npm run lint:js && npm run lint:ts",\n    "lint:js": "eslint \'src/**/*.js\'",\n    "lint:ts": "tslint --project tsconfig.json --config tslint.json",\n    "mocha": "nyc mocha --opts mocha.opts",\n    "prepare": "npm run clean && npm run build",\n    "prepublish": "npm run clean && npm run build",\n    "test": "npm run lint && npm run mocha"\n  },\n  "version": "6.4.0"\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

一开始我看到对 firebase-tools@6.7.1 的引用,但在文件的最后一行我确实有"version": "6.4.0"
\n实际安装了什么版本?更重要的是,我怎样才能解决这个问题,以便我安装报告了6.7.1firebase -V

\n