简体   繁体   中英

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.

May I suggest:

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM