Firebase托管:无法获取本地发行者证书
问题描述:
尝试开发并部署到Firebase Hosting,但是当我从PowerShell运行firebase init时收到以下错误消息:
Trying to develop and deploy to Firebase Hosting but getting the following error message when I run firebase init from PowerShell:
服务器错误.无法获得本地发行者证书
Server Error. unable to get local issuer certificate
有人知道吗?这是日志文件的内容:
Does anybody know about this? Here's the log file contents:
[debug] [2017-06-09T10:45:14.977Z] ----------------------------------------------------------------------
[debug] [2017-06-09T10:45:14.979Z] Command: C:\nodejs\node.exe C:\nodejs\node_modules\firebase-tools\bin\firebase init
[debug] [2017-06-09T10:45:14.979Z] CLI Version: 3.9.1
[debug] [2017-06-09T10:45:14.980Z] Platform: win32
[debug] [2017-06-09T10:45:14.980Z] Node Version: v7.9.0
[debug] [2017-06-09T10:45:14.980Z] Time: Fri Jun 09 2017 11:45:14 GMT+0100 (GMT Daylight Time)
[debug] [2017-06-09T10:45:14.980Z] ----------------------------------------------------------------------
[debug]
[debug] [2017-06-09T10:45:14.993Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
[debug] [2017-06-09T10:45:14.993Z] > authorizing via signed-in user
[info]
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
U:\firebase
[info]
=== Project Setup
[info]
[info] First, let's associate this project directory with a Firebase project.
[info] You can create multiple project aliases by running firebase use --add,
[info] but for now we'll just set up a default project.
[info]
[debug] [2017-06-09T10:45:29.107Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects
Fri Jun 09 2017 11:45:29 GMT+0100 (GMT Daylight Time)
[debug] [2017-06-09T10:45:29.692Z] Error: unable to get local issuer certificate
[error]
[error] Error: Server Error. unable to get local issuer certificate
非常感谢
答
我终于设法解决了同样的问题.只需设置以下环境变量:
I finally managed to solve this same exact problem. Simply set the following environtment variable:
set NODE_TLS_REJECT_UNAUTHORIZED=0
,firebase项目应正确初始化.但是,我认为该解决方案更像是骇客,而不是解决方案.
and the firebase project should initialize correctly. However, I believe that this solution is more similar to a hack rather than to a solution.