Firebase-tools: Firebase Deploy Command Failed (Error Must supply either "site" or "target" in each "hosting" config.)

Created on 1 Mar 2020  ·  3Comments  ·  Source: firebase/firebase-tools

I tried to run the command `firebase deploy" to deploy an app to Firebase but I had the error I mentioned in parentheses in the title:

 Error: Must supply either "site" or "target" in each "hosting" config.

This is what my .firebaserc file looks like currently:
```.firebaserc
{
"projects": {
"default": "phonestore-4e40c"
},
"targets": {
"phonestore-4e40c": {
"hosting": {
"phone-store": [
"phonestore-4e40c"
]
}
}
}
}

What do I do here to fix the error?  I tried adding `"target":` before `"phonestore-4e40c"` (it would become `"target": "phonestore-4e40c"`) but that didn't work either; it gave me this error:

! JSON error trying to load E:\programming\angular\phone-store.firebaserc

=== Deploying to 'phonestore-4e40c'...

i deploying hosting

Error: Must supply either "site" or "target" in each "hosting" config.

(This is almost the same as the one I got when I ran just `firebase deploy`; the only thing new is the line about a JSON error).  

Any help with this is much appreciated.  (Note: The reason I didn't open a "Bug Report" issue is that I wasn't sure if my issue qualifies as a bug report.)

Before that I had tried the `ng deploy` command since I was following the Angular Getting Started Tutorial and had gotten to the deployment part after following the whole thing ([here](https://angular.io/start/start-deployment)).  I'd chosen to deploy it to Firebase after downloading it to my computer.  The result of that was this:

ng deploy
� Building "phone-store"
Generating ES5 bundles for differential loading...
ES5 bundle generation complete.

chunk {2} polyfills-es2015.d39e6b85441999f66523.js (polyfills) 35.6 kB [initial] [rendered]
chunk {3} polyfills-es5.bb7828de73427b5cd027.js (polyfills-es5) 128 kB [initial] [rendered]
chunk {0} runtime-es2015.0811dcefd377500b5b1a.js (runtime) 1.45 kB [entry] [rendered]
chunk {0} runtime-es5.0811dcefd377500b5b1a.js (runtime) 1.45 kB [entry] [rendered]
chunk {1} main-es2015.d600346e98d8457cc378.js (main) 277 kB [initial] [rendered]
chunk {1} main-es5.d600346e98d8457cc378.js (main) 337 kB [initial] [rendered]
chunk {4} styles.f1fcab432634cda74b08.css (styles) 1.68 kB [initial] [rendered]
Date: 2020-03-01T15:29:58.651Z - Hash: 3f6a31e9de18891acf13 - Time: 40448ms
RangeError: Maximum call stack size exceeded
at formatError (internal/util/inspect.js:1095:20)
at formatRaw (internal/util/inspect.js:883:14)
at formatValue (internal/util/inspect.js:737:10)
at inspect (internal/util/inspect.js:280:10)
at formatWithOptionsInternal (internal/util/inspect.js:1886:40)
at format (internal/util/inspect.js:1762:10)
at Object.console.warn (E:\programming\angular\phone-store\node_modules\@angular\cli\lib\cli\index.js:46:35)
at Observable._trySubscribe (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Observable.js:55:25)
at Observable.subscribe (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Observable.js:30:22)
at MergeMapOperator.call (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\operators\mergeMap.js:39:23)
at Observable.subscribe (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Observable.js:25:31)
at IgnoreElementsOperator.call (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\operators\ignoreElements.js:27:23)
at Observable.subscribe (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Observable.js:25:31)
at Object.subscribeToResult (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\util\subscribeToResult.js:12:23)
at MergeMapSubscriber._innerSub (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\operators\mergeMap.js:82:29)
at MergeMapSubscriber._tryNext (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\operators\mergeMap.js:76:14)
at MergeMapSubscriber._next (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\operators\mergeMap.js:59:18)
at MergeMapSubscriber.Subscriber.next (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:66:18)
at Observable._subscribe (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\util\subscribeToArray.js:5:20)
at Observable._trySubscribe (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Observable.js:44:25)
at Observable.subscribe (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Observable.js:30:22)
at MergeMapOperator.call (E:\programming\angular\phone-store\node_modules\@angular-devkit\core\node_modules\rxjs\internal\operators\mergeMap.js:39:23)
`` Would be good if I could get this to work. If not, then thefirebase deploy` command working would be good too.

Most helpful comment

Okay, something weird must've been happening because I just ran ng deploy again and this time it worked.

All 3 comments

Okay, something weird must've been happening because I just ran ng deploy again and this time it worked.

Thanks @DragonOsman, firebase deploy command not working, I have to use ng deploy command.

Getting the same error but found a workaround.
"firebase deploy" works for me after adding extra line "target": "app" in the firebase.json config file, as follows:

{
"hosting": [
{
"target": "app",
"public": "www",
...

Was this page helpful?
0 / 5 - 0 ratings