title: Error: Cannot find module - Working locally but not on Heroku
body: <p>I am running a node application that I cloned from my Heroku container. locally, it runs and the app operates from localhost:3000.</p>
  
  <p>However when I deploy the app using git deploy to heroku, it starts and then immediately crashes. The heroku log is pasted below.</p>
  
  <p>I can't work out why I am getting this error?</p>
  
  <p>I've tried updating npm, deleteing node modules.</p>
  
  <pre><code>rm -rf node_modules
  npm i core-util-is
  npm install -g npm@latest
  </code></pre>
  
  <p>The heroku log looks like:</p>
  
  <pre><code>2019-06-24T15:35:26.071317+00:00 app[web.1]: &gt; node index.js
  2019-06-24T15:35:26.071318+00:00 app[web.1]: 
  2019-06-24T15:35:26.251019+00:00 app[web.1]: internal/modules/cjs/loader.js:638
  2019-06-24T15:35:26.251023+00:00 app[web.1]:     throw err;
  2019-06-24T15:35:26.251024+00:00 app[web.1]:     ^
  2019-06-24T15:35:26.251026+00:00 app[web.1]: 
  2019-06-24T15:35:26.251027+00:00 app[web.1]: Error: Cannot find module './putty'
  2019-06-24T15:35:26.251031+00:00 app[web.1]:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
  2019-06-24T15:35:26.251033+00:00 app[web.1]:     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
  2019-06-24T15:35:26.251034+00:00 app[web.1]:     at Module.require (internal/modules/cjs/loader.js:690:17)
  2019-06-24T15:35:26.251036+00:00 app[web.1]:     at require (internal/modules/cjs/helpers.js:25:18)
  2019-06-24T15:35:26.251037+00:00 app[web.1]:     at Object.&lt;anonymous&gt; (/app/node_modules/sshpk/lib/formats/auto.js:18:13)
  2019-06-24T15:35:26.251039+00:00 app[web.1]:     at Module._compile (internal/modules/cjs/loader.js:776:30)
  2019-06-24T15:35:26.251040+00:00 app[web.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
  2019-06-24T15:35:26.251041+00:00 app[web.1]:     at Module.load (internal/modules/cjs/loader.js:653:32)
  2019-06-24T15:35:26.251043+00:00 app[web.1]:     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
  2019-06-24T15:35:26.251044+00:00 app[web.1]:     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
  2019-06-24T15:35:26.259163+00:00 app[web.1]: npm ERR! code ELIFECYCLE
  2019-06-24T15:35:26.259707+00:00 app[web.1]: npm ERR! errno 1
  2019-06-24T15:35:26.261454+00:00 app[web.1]: npm ERR! hello@1.0.0 start: `node index.js`
  2019-06-24T15:35:26.261645+00:00 app[web.1]: npm ERR! Exit status 1
  2019-06-24T15:35:26.261955+00:00 app[web.1]: npm ERR! 
  2019-06-24T15:35:26.262153+00:00 app[web.1]: npm ERR! Failed at the hello@1.0.0 start script.
  2019-06-24T15:35:26.262343+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  2019-06-24T15:35:26.270567+00:00 app[web.1]: 
  2019-06-24T15:35:26.270795+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
  2019-06-24T15:35:26.270955+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2019-06-24T15_35_26_264Z-debug.log
  </code></pre>