我正在尝试使用npm将firebase-tools更新到最新版本(6.7.1)。 firebase -V
一直在报告旧版本(6.4.0),但是我不确定是否已更新。这是在Ubuntu Linux中
这是我在终端上所做的
hili@dev:~$ npm list -g | grep fireb
└─┬ firebase-tools@6.4.0
├─┬ firebase@2.4.2
hili@dev:~$ sudo npm update -g firebase-tools
[sudo] password for hili:
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
+ firebase-tools@6.7.1
updated 1 package in 15.73s
hili@dev:~$ npm list -g | grep fireb
└─┬ firebase-tools@6.4.0
├─┬ firebase@2.4.2
请注意,更新后,它确实报告了新版本,但是当我列出时,它仍然显示旧版本。
我尝试在/usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
中调试脚本,然后看到了
var pkg = require("../../package.json");
...
logger.debug("CLI Version: ", pkg.version);
因此,我签入/usr/local/lib/node_modules/firebase-tools/package.json
,然后看到了。它似乎是新旧版本的融合
{
"_from": "firebase-tools@6.7.1",
"_id": "firebase-tools@6.7.1",
"_inBundle": false,
"_integrity": "sha512-8JZ2QA1gylgmlGNULrhTtkk5iS+OumCoJEgK+RNLt/ji1hSxzZehWCb13jHtqCRNRz+Kt+uwsrmExbhsNNqiBw==",
"_location": "/firebase-tools",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "firebase-tools@6.7.1",
"name": "firebase-tools",
"escapedName": "firebase-tools",
"rawSpec": "6.7.1",
"saveSpec": null,
"fetchSpec": "6.7.1"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/firebase-tools/-/firebase-tools-6.7.1.tgz",
"_shasum": "c80ddc9cfd6ca6611b50e3e656f8bee30621c6f3",
"_spec": "firebase-tools@6.7.1",
"_where": "/home/hili",
"author": {
"name": "Firebase",
"url": "https://firebase.google.com/"
},
"bin": {
"firebase": "./lib/bin/firebase.js"
},
"bugs": {
"url": "https://github.com/firebase/firebase-tools/issues"
},
"bundleDependencies": false,
"dependencies": {
"@google-cloud/functions-emulator": "^1.0.0-beta.5",
"JSONStream": "^1.2.1",
"archiver": "^2.1.1",
"cjson": "^0.3.1",
"cli-color": "^1.2.0",
"cli-table": "^0.3.1",
"commander": "^2.8.1",
"configstore": "^1.2.0",
"cross-env": "^5.1.3",
"cross-spawn": "^4.0.0",
"csv-streamify": "^3.0.4",
"didyoumean": "^1.2.1",
"es6-set": "^0.1.4",
"exit-code": "^1.0.2",
"filesize": "^3.1.3",
"firebase": "2.x.x",
"fs-extra": "^0.23.1",
"glob": "^7.1.2",
"google-auto-auth": "^0.7.2",
"inquirer": "^0.12.0",
"is": "^3.2.1",
"jsonschema": "^1.0.2",
"jsonwebtoken": "^8.2.1",
"lodash": "^4.17.10",
"minimatch": "^3.0.4",
"opn": "^5.3.0",
"ora": "0.2.3",
"portfinder": "^1.0.13",
"progress": "^2.0.0",
"request": "^2.87.0",
"semver": "^5.0.3",
"superstatic": "^6.0.1",
"tar": "^4.3.0",
"tmp": "0.0.33",
"universal-analytics": "^0.4.16",
"update-notifier": "^2.5.0",
"user-home": "^2.0.0",
"uuid": "^3.0.0",
"winston": "^1.0.1"
},
"deprecated": false,
"description": "Command-Line Interface for Firebase",
"devDependencies": {
"@types/chai": "^4.1.6",
"@types/chai-as-promised": "^7.1.0",
"@types/cli-color": "^0.3.29",
"@types/express": "^4.16.0",
"@types/glob": "^7.1.1",
"@types/lodash": "^4.14.118",
"@types/mocha": "^5.2.5",
"@types/nock": "^9.3.0",
"@types/node": "^10.12.0",
"@types/opn": "~5.1.0",
"@types/request": "^2.48.1",
"@types/sinon": "^5.0.5",
"@types/supertest": "^2.0.6",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"coveralls": "^3.0.1",
"eslint": "^5.7.0",
"eslint-plugin-prettier": "^3.0.0",
"express": "^4.16.4",
"mocha": "^5.0.5",
"nock": "^9.3.3",
"nyc": "^13.3.0",
"prettier": "1.14.3",
"sinon": "^6.3.4",
"sinon-chai": "^3.2.0",
"source-map-support": "^0.5.9",
"supertest": "^3.3.0",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"tslint-no-unused-expression-chai": "^0.1.4",
"tslint-plugin-prettier": "^2.0.0",
"typescript": "^3.1.3"
},
"engineStrict": true,
"engines": {
"node": ">= 6.0.0"
},
"files": [
"lib",
"templates"
],
"homepage": "https://github.com/firebase/firebase-tools",
"keywords": [
"cdn",
"cli",
"ssl",
"cloud",
"hosting",
"firebase",
"realtime",
"websockets",
"synchronization"
],
"license": "MIT",
"main": "./lib/index.js",
"name": "firebase-tools",
"nyc": {
"require": [
"ts-node/register"
],
"extension": [
".js",
".ts"
],
"exclude": [
"src/test/**/*"
]
},
"optionalDependencies": {
"@google-cloud/functions-emulator": "^1.0.0-beta.5"
},
"preferGlobal": true,
"repository": {
"type": "git",
"url": "git+https://github.com/firebase/firebase-tools.git"
},
"scripts": {
"build": "tsc",
"build:watch": "tsc --watch",
"clean": "rm -rf lib",
"format": "prettier --write 'src/**/*.{js,ts}'",
"lint": "npm run lint:js && npm run lint:ts",
"lint:js": "eslint 'src/**/*.js'",
"lint:ts": "tslint --project tsconfig.json --config tslint.json",
"mocha": "nyc mocha --opts mocha.opts",
"prepare": "npm run clean && npm run build",
"prepublish": "npm run clean && npm run build",
"test": "npm run lint && npm run mocha"
},
"version": "6.4.0"
}
一开始我看到对firebase-tools@6.7.1的引用,但是在文件的最后一行中,我确实有"version": "6.4.0"
实际安装了什么版本?更重要的是,如何解决此问题,以便在firebase -V