user9754798
user9754798

Reputation: 443

Hosting site or target not detected in firebase.json

I've just created a new Firebase project, and I'm trying to get my Angular app hosted properly but I'm getting Hosting site or target partwizard not detected in firebase.json when I try to run ng deploy.

I'm following the steps on the official Angular docs here: https://angular.io/start/start-deployment#hosting-an-angular-app-on-firebase

My dist folder that is built on ng build --prod is dist/projectName, I've tried using

{
  "hosting": {
    "public": "public",
    ]
  }
}

and

{
  "hosting": {
    "public": "dist/projectName",
    ]
  }
}

and

{
  "hosting": {
    "public": "dist",
    ]
  }
}

But none work.

Upvotes: 5

Views: 11962

Answers (3)

Steve
Steve

Reputation: 11

I solved this by logging out of firebase in the CLI and logging back in, reinitializing the firebase project, and deploying worked.

Upvotes: 0

win4win
win4win

Reputation: 363

So full process is

sudo ng build --prod

Not doing the above step will leave your app page at the welcome title.

sudo firebase init

single app yes

Overwrite index No

Now for some odd reason, after firebase init happens, it will delete site in your firebase.json, just add it again.

 "site": "YOUR-SITE",

then

sudo firebase deploy --only hosting:YOUR-SITE

firebase init deleting site in firebase.json seems like a new thing happening, took me awhile to figure it out.

Upvotes: 3

Louis Coulet
Louis Coulet

Reputation: 4641

May I suggest:

{
  "hosting": [{
    "target": "partwizard",
    "public": path to the folder containing your index.html
  }]
}

Upvotes: 13

Related Questions