title: Node.js cannot find module, despite module being installed
body: <ul>
  <li><p>I build my application locally into a <code>dist</code> folder; package.json is also copied over</p></li>
  <li><p><code>npm install --production</code> is run in the dist folder</p></li>
  <li><p><code>dist</code> folder is then zipped up</p></li>
  <li><p>Zip is uploaded to server, where it is unzipped</p></li>
  <li><p>Attempting to run the application on the server results in <code>Error: cannot find module &lt;module_name&gt;</code></p></li>
  </ul>
  
  <p>This error occurs for any module unless I manually run <code>npm install &lt;module_name&gt;</code> after the unzip</p>
  
  <p>Everything works fine if I run it from my <code>dist</code> folder, so it's not an issue with the pre-zip part</p>
  
  <p>Running <code>npm install --production</code> after the unzip doesn't resolve anything (just says that all modules are up-to-date)</p>
  
  <p>Deleting <code>node_modules</code> on the server, then running <code>npm install --production</code> makes everything work fine</p>
  
  <p>Unzipping the zip file locally then running the application works fine</p>
  
  <p>What am I missing/doing wrong?</p>
  
  <p>EDIT: package.json:</p>
  
  <pre><code>{
      "name": "app-name",
      "version": "0.0.1",
      "scripts": {
          "start": "index.js"
      },
      "dependencies": {
          "body-parser": "^1.18.2",
          "email-validator": "^1.1.1",
          "express": "^4.16.2",
          "express-jwt": "^5.3.0",
          "express-jwt-permissions": "^1.0.0",
          "firebase-admin": "^5.5.1",
          "jsonwebtoken": "^8.1.0",
          "mailgun-js": "^0.13.1",
          "mysql2": "^1.5.0",
          "password-hash-and-salt": "^0.1.4",
          "randomstring": "^1.1.5",
          "reflect-metadata": "^0.1.10",
          "sequelize": "^4.22.6",
          "sequelize-typescript": "^0.5.0"
      },
      "devDependencies": {
          "@types/express": "^4.0.39",
          "@types/express-jwt": "0.0.38",
          "@types/jsonwebtoken": "^7.2.4",
          "@types/node": "^8.0.51",
          "@types/sequelize": "^4.0.79",
          "babel-core": "^6.26.0",
          "del": "^3.0.0",
          "gulp": "^3.9.1",
          "gulp-babel": "^7.0.0",
          "gulp-ssh": "^0.6.0",
          "gulp-typescript": "^3.2.3",
          "gulp-zip": "^4.0.0",
          "merge-stream": "^1.0.1",
          "typescript": "^2.6.1"
      }
  }
  </code></pre>