Answers for "Could not start Firestore Emulator, port taken mac"

1

Could not start Firestore Emulator, port taken mac

# kill process running in port 9000
lsof -ti tcp:9000 | xargs kill -9

# create a bash script - kill-ports.bash
# copy and paste the below script
#Stop following command execution if command before failed
set -e

kill_functions_port() {
    # functions emulator port number
    lsof -ti tcp:5001 | xargs kill -9
}

kill_firestore_port() {
    # firestore emulator port number
    lsof -ti tcp:8080 | xargs kill -9
}

kill_database_port() {
    # database emulator port number
    lsof -ti tcp:9000 | xargs kill -9
}

kill_functions_port && kill_firestore_port && kill_database_port

# add script to package.json 
scripts {
  ...
  "kill-ports": "./kill-ports.bash",
}

# call in bash terminal
npm run kill-ports

# grant permission if required to run
chmod -R +x ./kill-ports
Posted by: Guest on June-22-2021

Code answers related to "Could not start Firestore Emulator, port taken mac"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language