title: Unable to connect to firebase emulator suite with exec
body: <p>Started firebase project emulators (which uses cloud functions and firestore) with below command</p>
  <pre><code>firebase emulators:start
  </code></pre>
  <p>It runs successfully and gives me a path to connect to the functions and shows a local host url for firestore too.</p>
  <p>Then, to execute my jest tests, ran the below command</p>
  <pre><code>firebase emulators:exec --only firestore jest
  </code></pre>
  <p>As per the documentation, to connect to local firstore, we need to use exec. But its throwing below error.</p>
  <pre><code>i  emulators: Starting emulators: firestore
  ⚠  emulators: emulator hub unable to start on port 4400, starting on 4401
  ✔  hub: emulator hub started at http://localhost:4401
  i  Shutting down emulators.
  i  Stoppping emulator hub
  ⚠  Port 8080 is not open on localhost, could not start firestore emulator.
  i  To select a different host/port for the emulator, update your &quot;firebase.json&quot;:
      {
        // ...
        &quot;emulators&quot;: {
          &quot;firestore&quot;: {
            &quot;host&quot;: &quot;HOST&quot;,
            &quot;port&quot;: &quot;PORT&quot;
          }
        }
      }
  i  Shutting down emulators.
  Error: Could not start firestore emulator, port taken.
  </code></pre>
  <p>This error is thrown everytime when I run exec command. Can someone point out what could be wrong?</p>
  <p>Edit: Logs from firebase emulators:start</p>
  <pre><code>firebase emulators:start
  i  emulators: Starting emulators: functions, firestore, hosting, pubsub
  ✔  hub: emulator hub started at http://localhost:4400
  ⚠  Your requested &quot;node&quot; version &quot;8&quot; doesn't match your global version &quot;10&quot;
  ✔  functions: functions emulator started at http://localhost:5001
  i  firestore: Serving ALL traffic (including WebChannel) on http://localhost:8080
  ⚠  firestore: Support for WebChannel on a separate port (8081) is DEPRECATED and will go away soon. Please use port above instead.
  i  firestore: firestore emulator logging to firestore-debug.log
  ✔  firestore: firestore emulator started at http://localhost:8080
  i  firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
  i  hosting[website]: Serving hosting files from: public
  ✔  hosting[website]: Local server: http://localhost:5000
  i  hosting[admin]: Serving hosting files from: public
  ✔  hosting[admin]: Local server: http://localhost:5005
  i  hosting[b2b]: Serving hosting files from: public
  ✔  hosting[b2b]: Local server: http://localhost:5006
  i  hosting[b2c]: Serving hosting files from: public
  ✔  hosting[b2c]: Local server: http://localhost:5007
  i  hosting[sdk]: Serving hosting files from: public
  ✔  hosting[sdk]: Local server: http://localhost:5008
  ✔  hosting: hosting emulator started at http://localhost:5000
  i  pubsub: pubsub emulator logging to pubsub-debug.log
  ✔  pubsub: pubsub emulator started at http://localhost:8085
  </code></pre>
  <p><strong>Update</strong></p>
  <p>With a fresh start also the mentioned error is shown. But killing the port made it work.</p>
  <p>Added below in scipts part of package.json</p>
  <pre><code>&quot;kill&quot;: &quot;npx kill-port 5000 5001 8080 8085 4000 9229&quot;
  </code></pre>
  <p>and run</p>
  <pre><code>npm run kill
  </code></pre>
  <p>Here all above listed ports aren't reqired. Just 8080 might work in your case but I have other ports too being used by the emulator.</p>