firebase / firebase/friendlyeats-web
firebase emulator not working
- Dominant language
- JavaScript
- Stars
- 597
- Forks
- 456
- PR merge metrics
- No merged PRs in 30d
Description
I attempted to follow this step [here](https://firebase.google.com/codelabs/firestore-web#4) but when I ran the command `firebase emulators:start --only hosting` it would gave me the following error `Error: Could not start Hosting Emulator, port taken.`
```
firebase emulators:start --only hosting
i emulators: Starting emulators: hosting
i emulators: Shutting down emulators.
i hub: Stopping emulator hub
⚠ hosting: Port 5000 is not open on localhost, could not start Hosting Emulator.
⚠ hosting: To select a different host/port, specify that host/port in a firebase.json config file:
{
// ...
"emulators": {
"hosting": {
"host": "HOST",
"port": "PORT"
}
}
}
i emulators: Shutting down emulators.
Error: Could not start Hosting Emulator, port taken.
```
I think a fix is to add the following in `firebase.json` file, though wonder if there's a way to use dynamic open port variables instead of hardcoding ones:
```
"emulators": {
"firestore": {
"port": 5002
},
"functions": {
"port": 5001
},
"hosting": {
"port": 5005
}
},
```
Contributor guide
Research direction
Start by inspecting the repository's firebase.json and reproducing `firebase emulators:start --only hosting` to confirm the port conflict. Compare the existing emulator configuration with the proposed Firestore, Functions, and Hosting ports; done means the documented setup starts successfully without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- firebase, javascript
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100