Firebase Web Init错误文件已存在

时间:2019-04-20 21:15:15

标签: node.js firebase firebase-cli

我已经安装了Node.js,npm和firebase-tools。我想使用Firebase托管部署Web应用程序。我遵循文档并按照所示执行命令,但是出现意外错误。我已经发布了Firebase调试日志。我该如何解决? Command logs

[debug] [2019-04-20T21:08:12.230Z] ----------------------------------------------------------------------
[debug] [2019-04-20T21:08:12.233Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\Cameron\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js init
[debug] [2019-04-20T21:08:12.233Z] CLI Version:   6.7.0
[debug] [2019-04-20T21:08:12.233Z] Platform:      win32
[debug] [2019-04-20T21:08:12.233Z] Node Version:  v11.14.0
[debug] [2019-04-20T21:08:12.234Z] Time:          Sat Apr 20 2019 17:08:12 GMT-0400 (Eastern Daylight Time)
[debug] [2019-04-20T21:08:12.234Z] ----------------------------------------------------------------------
[debug] 
[debug] [2019-04-20T21:08:12.241Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2019-04-20T21:08:12.242Z] > authorizing via signed-in user
[info] 
     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  C:\Users\Cameron

Before we get started, keep in mind:

  * You are initializing your home directory as a Firebase project

[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] [2019-04-20T21:08:16.637Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2019-04-20T21:08:16.638Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token  
 <request body omitted>
[debug] [2019-04-20T21:08:16.846Z] <<< HTTP RESPONSE 200
[debug] [2019-04-20T21:08:16.878Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects?page_size=100  

[debug] [2019-04-20T21:08:17.215Z] <<< HTTP RESPONSE 200
[info] i  Using project autoretarb (autoretarb)
[info] 
=== Hosting Setup
[info] 
[info] Your public directory is the folder (relative to your project directory) that
[info] will contain Hosting assets to be uploaded with firebase deploy. If you
[info] have a build process for your assets, use your build's output directory.
[info] 
[debug] [2019-04-20T21:08:33.318Z] Error: EEXIST: file already exists, mkdir 'C:\Users\Cameron'
    at Object.mkdirSync (fs.js:773:3)
    at mkdirsSync (C:\Users\Cameron\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:22:9)
    at mkdirsSync (C:\Users\Cameron\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:27:16)
    at mkdirsSync (C:\Users\Cameron\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9)
    at mkdirsSync (C:\Users\Cameron\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9)
    at mkdirsSync (C:\Users\Cameron\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9)
    at mkdirsSync (C:\Users\Cameron\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9)
    at mkdirsSync (C:\Users\Cameron\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9)
    at mkdirsSync (C:\Users\Cameron\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9)
    at mkdirsSync (C:\Users\Cameron\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9)
[error] 
[error] Error: An unexpected error has occurred.

2 个答案:

答案 0 :(得分:1)

首先请注意顶部附近的警告:

  

开始之前,请紧记:

     
      
  • 您正在将主目录初始化为Firebase项目
  •   

请确保您要使用主目录作为项目根目录。通常这不是一个好主意。如果您想在主目录中创建其他项目,肯定会导致问题。相反,我建议您创建一个新目录并从那里运行firebase init。 CLI将要在其中创建许多其他文件和目录。

现在,请注意出现错误的提示:

  

您的公共目录是文件夹(相对于您的项目   目录),其中包含要与之一起上传的托管资产   Firebase部署。如果您有资产的构建流程,   使用构建的输出目录。

它具体说来是相对于您的项目目录,但是您给了它一个绝对路径“ C:\ Biz Drive \ admin_public”。

最好让Firebase CLI在项目文件夹内的默认位置创建公用文件夹,除非您知道自己有非常特殊的需要。为了开始使用,我建议您仅使用默认值,然后稍后再在firebase.json中对其进行修改。

答案 1 :(得分:0)

如果您使用的是Windows

遇到相同的错误,然后我以管理员身份运行命令提示符,然后问题解决了。