-1

I've installed Node.js, npm, and firebase-tools. I want to deploy a web app using Firebase hosting. I follow the documentation and do the commands as shown, but I get an unexpected error. I've posted the firebase debug log. How do I fix this? 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.
Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Rontron
  • 3,963
  • 7
  • 26
  • 44

2 Answers2

1

First of all notice the warning near the top:

Before we get started, keep in mind:

  • You are initializing your home directory as a Firebase project

Please be certain that you want to use your home directory as a project root. This generally is not a really good idea. It will definitely cause problems later if you want to create other projects in your home directory. Instead, I suggest you create a new directory and run firebase init from there. The CLI will want to create bunch of other files and dirs there.

Now, notice the prompt where you got the error:

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.

It specifically says relative to your project directory, but you gave it an absolute path "C:\Biz Drive\admin_public".

It's better to allow the Firebase CLI to create the public folder at its default location within the project folder, unless you know you have a very specific need otherwise. In order to get started, I suggest just taking the defaults, then modifying them later in firebase.json afterward.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • Thanks, it worked after I changed the root directory to a project folder and left the public directory blank. I'm just new to firebase and node.js – Rontron Apr 21 '19 at 15:17
0

If you are using Windows

I faced same error then I just run command prompt as admin then problem solved.

TAHA SULTAN TEMURI
  • 4,031
  • 2
  • 40
  • 66