如何更改我已安装的Firebase的目录?

问题描述 投票:-1回答:1

我已经通过运行npm install -g firebase-tools和其他命令安装了Firebase,但是由于某种错误消息,我仍然无法在我的离子项目目录中运行任何firebase命令,因为它会显示错误消息

'firebase'不被识别为内部或外部命令,可运行程序或批处理文件。

关闭firebase已安装到其他目​​录,而不是我的项目目录。这就是为什么我无法在项目目录中运行firebase命令的原因。我只能在已安装的目录中运行firebase命令。

谁知道如何将Firebase安装到特定项目目录?我做了一些研究。一些解决方案是修改firebase.json文件中的代码,但是我的firebase.json文件为空,我试图像这样更改代码,但它仍然可以工作。

{
  "hosting": {
    "public": "C:/Users/CJ/desktop/fyp"
  }
}

-

-npm install firebase-tools对我不起作用,这是结果:

C:\Users\CJ\Desktop\fyp\tools\functions>npm install firebase-tools
npm WARN [email protected] requires a peer of firebase-admin@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ [email protected]
updated 1 package and audited 6497 packages in 54.671s

1 package is looking for funding
  run `npm fund` for details

found 200 vulnerabilities (122 moderate, 78 high)
  run `npm audit fix` to fix them, or `npm audit` for details

C:\Users\CJ\Desktop\fyp\tools\functions>firebase
'firebase' is not recognized as an internal or external command,
operable program or batch file.
node.js windows firebase firebase-cli
1个回答
0
投票

如果运行npm install -g,则由NPM决定软件包/工具的安装位置。 Firebase无法对此进行控制。

如果要在本地项目方向上安装Firebase CLI,请使用npm install选项运行-g命令:

npm install firebase-tools
© www.soinside.com 2019 - 2024. All rights reserved.