我正在将我的 React 应用程序部署到 firebase 托管。当我创建 firebase init 并选择所有选项时,我收到此错误。
C:\Users\user\git\Apps\screem>firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
C:\Users\user\git\Apps\screem
? Are you ready to proceed? Yes
? Which Firebase CLI features do you want to set up for this folder? Press Space to select features, then Enter to confi
rm your choices. Hosting: Configure and deploy Firebase Hosting sites
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
? Please select an option: Use an existing project
? Select a default Firebase project for this directory: screem-59e13 (screem)
i Using project screem-59e13 (screem)
=== Hosting Setup
Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.
? What do you want to use as your public directory? build
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
? Set up automatic builds and deploys with GitHub? No
Error: Failed to make request to https://www.gstatic.com/firebasejs/releases.json
知道如何解决这个问题吗?
为了了解错误的根本原因,请尝试使用调试选项运行 Firebase init 命令:
firebase init --debug
有可能由于“证书链中的自签名证书”而导致请求失败。如果是这样,您将在调试输出中看到此错误,然后您可以参考此 StackOverflow 问题以获取解决方法或解决问题的方法:nodejs - 证书链中的错误自签名证书
错误:无法向
https://www.gstatic.com/firebasejs/releases.json
发出请求
要解决此问题,请运行以下命令:
firebase init --debug
它会100%工作
这对我有用。 在运行命令
npm install -g firebase-tools
之前运行 firebase init
。
尝试使用以下命令重新登录 Firebase:
firebase login --reauth