# Firebase 命令行工具

**URL:** <https://www.isharkfly.com/t/firebase/13410>\
**Category:** DevOps\
**Tags:** firebase\
**Created:** [March 28, 2021, 4:19am UTC](https://www.isharkfly.com/t/firebase/13410 "2021-03-28T04:19:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [March 28, 2021, 4:19am UTC](https://www.isharkfly.com/t/firebase/13410/1 "2021-03-28T04:19:24Z")

</div>

Firebase 是 Google 提供的一个工具。

你可以将你的 Angular 项目部署上去。

要使用 Firebase，首先需要安装 Firebase CLI。

下载的地址为：[Firebase CLI reference &nbsp;|&nbsp; Firebase Documentation](https://firebase.google.com/docs/cli#sign-in-test-cli)

 ![2329997ee8a2b1d97ce34a4bd759a891c9d98a25_2_1033x735](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/f/0/f0bc008d5789017212c0613865490aa122fd8fdf.png)  
下载成功后，双击运行。

在很多时候，可能会 Windows 有提示权限不够，或者你程序有风险，这些你都需要接受风险才能进行下一步。

 ![b7a4502db4c48b52a3384b88bd75c189063a0746](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/0/5/053be28e1404f17e785ca580921ca7f99cc7bec5.png)  
因为可能需要下载安装 visual studio，所以上面的过程会比较长。

如果没提示退出，请耐心等待。

## npm 安装

当然，你也可以使用 npm 直接进行安装。

安装的命令为： `npm install -g firebase-tools`

如果你得到了提示为

`gyp ERR! find VS You need to install the latest version of Visual Studio gyp ERR! find VS including the "Desktop development with C++" workload. gyp ERR! find VS For more information consult the documentation at: gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows`

 ![68d38511f5e9b53cb752d6e2f846eb843788cde1](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/9/1/91e5ef5b19fa7a0cccd63f0a9bf7ab36f216b335.png)  
这是因为在 Firebase 安装的时候需要使用 visual studio 的 C++ 编译器来进行编译。

你可以选择下载 Windows 的 visual studio C++ 编译器。

目前，你可以下载最新的 2019 年构建版本，下载地址为： [Visual Studio & VS Code Downloads for Windows, Mac, Linux](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019)

 ![c2413260b25349ed35c565f07f6a4c25d7cb899b_2_581x499](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/0/4/041bd137970ebf32a84521812e0b1ee5d02e3ff8.png)  
在下载完成后，选择运行这个构建版本。

然后可以选择桌面开发工具同时包含有 C++

 ![c2413260b25349ed35c565f07f6a4c25d7cb899b_2_871x748](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/4/d/4d4b3a9e1612781f4b2f58175a3a8819286de191.png)

然后等待安装的完成。

 ![2a034e8b13a01c2a2477d7191b4c13f47fe2534a](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/5/8/58d53f46fbfe755af29beb7beeb9ea3b4d21c936.png)  
如果安装还不成功的话，可以设置 `npm config set msvs_version 2019` 这个命令的意思是让 npm 使用 2019 年的版本进行编译。

如果你安装的是 2017 或者 2015 你也可以在命令行的后面设置不同的版本。

然后再次运行：`npm install -g firebase-tools` 来进行安装。

如果一切顺利，你将可能会看到输出如下图所示。

 ![951c329c645661152823fe5810220fe0a50473b3_2_1033x577](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/4/9/49d3b46652afe216a4437fcf961898b5798f46a4.png)  
上面的输出表示的是 firebase 已经安装成功了。

## 检查版本

可以通过运行下面的命令：`firebase -V` 来检查安装的版本。

 ![2a034e8b13a01c2a2477d7191b4c13f47fe2534a_2_1033x577](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/2/8/283f0e691fd6efc80cfff0f399b76980f1ed2786.png)  
如果一切顺利，你将会看到已经安装成功的版本。

至此，说明你的 Firebase 已经配置成功，并且可以使用了。
