title: firebase functions, javascript: how to test locally if all packages are specified in package.json
body: <p>I get this error message when deploying my firebase function:</p>
  <pre><code>Function execution started
  Provided module can't be loaded.
  Did you list all required modules in the package.json dependencies?
  Detailed stack trace: Error: Cannot find module '@docsndata/testing-stub-graphql'
  Require stack:
  - /workspace/local_deps/workflow/core2/dist/cjs/recordManagement/StubRecordManagement.js
  - /workspace/local_deps/workflow/core2/dist/cjs/index.js
  - /workspace/local_deps/cyclepositive/webhook2/dist/cjs/onWebBooking.js
  - /workspace/local_deps/cyclepositive/webhook2/dist/cjs/index.js
  - /workspace/lib/index.js
  - /layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/loader.js
  - /layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/main.js
  at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
  at Function.Module._load (internal/modules/cjs/loader.js:746:27)
  at Module.require (internal/modules/cjs/loader.js:974:19)
  at require (internal/modules/cjs/helpers.js:101:18)
  at Object.&lt;anonymous&gt; (/workspace/local_deps/workflow/core2/dist/cjs/recordManagement/StubRecordManagement.js:9:32)
  at Module._compile (internal/modules/cjs/loader.js:1085:14)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
  at Module.load (internal/modules/cjs/loader.js:950:32)
  at Function.Module._load (internal/modules/cjs/loader.js:790:12)
  at Module.require (internal/modules/cjs/loader.js:974:19)
  Could not load the function, shutting down.
  </code></pre>
  <p>I know what the root cause is - I have a dependency that is not in package.json</p>
  <p>My question is: how do I test this locally?  When I do this:</p>
  <pre><code>firebase emulators:start --only functions
  </code></pre>
  <p>my function starts.  So it seems like the deploy process of the function does something different, like actively check for missing packages.  How can I check I have that right, before even attempting to deploy?</p>
  <p><strong>Edit #1</strong> Rewording and retagging to reflect fact that am using firebase functions, not google cloud functions directly.</p>
  <p><strong>Edit #2</strong> I tried deploying again this morning, after three of the above failures last night, and now it works.  Is the deployment process flaky?  Regardless, question still stands:  what is the best way to test the firebase deploy process locally?</p>