title: GCP Cloud Function: Cannot find npm module
body: <p>so i am building a cloud function, and I structured my code into multiple files.</p>
  
  <p>My index.js goes as this:</p>
  
  <pre><code>const { postHandler } = require('./requestHandler.js');
  
  const httpHandler = (req, res) =&gt; {
    const { method } = req;
  
    switch (method) {
      case 'POST':
        postHandler(req, res);
        break;
      case 'GET':
        getHandler(req, res);
        break;
      case 'DELETE':
        deleteHandler(req, res);
        break;
      case 'PUT':
        putHandler(req, res);
        break;
      default:
        return res.sendStatus(400).json({message: 'Invalid method. Allowed are POST, GET, DELETE'});
    }
  }
  
  exports.httpHandler = httpHandler
  </code></pre>
  
  <p>And this is the requestHandler </p>
  
  <pre><code>const createReviewApp = require('./createReviewApp')
  
  const postHandler = ( req, res ) =&gt; {
    const { path } = req;
    return createReviewApp( req, res )
  }
  
  module.exports = { postHandler }
  </code></pre>
  
  <p>This is the createReviewApp</p>
  
  <pre><code>const _compute = require('./computeClass.js');
  const _dns = require('./dnsClass.js');
  const _storage = require('./storageClass.js');
  
  const createReviewApp = ( req, res ) =&gt; {
       // doing something
  }
  </code></pre>
  
  <p>And this is my computeClass</p>
  
  <pre><code>const Compute = require('@google-cloud/compute')
  
  const projectId = process.env.GOOGLE_PROJECT_ID;
  
  class ComputeSingleton {
    constructor(){
      this.compute = new Compute({
        projectId,
      });
    }
    getVm({zoneName, vmName}){
      return this.getZone({zoneName}).vm(vmName).get();
    }
    getZone({zoneName}){
      return this.compute.zone(zoneName);
    }
    createVm({zoneName, vmName, config}){
      return this.getZone({zoneName}).createVM(vmName, config);
    }
    deleteVm({zoneName, vmName}){
      return this.getZone({zoneName}).vm(vmName).delete();
    }
  }
  
  module.exports = new ComputeSingleton()
  </code></pre>
  
  <p>Now, in my computeClass i am getting the following error:</p>
  
  <pre><code> Cannot find module '@google-cloud/compute
  </code></pre>
  
  <p>I have my dependencies installed, do I need to put all my code in one file?</p>
  
  <p><strong>Edit:</strong> I am testing it on functions nodejs emulator</p>