title: how to deploy nuxt to heroku?
body: <p>I have a nuxt/express build I am trying to deploy to Heroku. </p>
  
  <p>I followed nuxt documentation and have have set my heroku config like so: </p>
  
  <pre><code>heroku config:set NPM_CONFIG_PRODUCTION=false
  heroku config:set HOST=0.0.0.0
  heroku config:set NODE_ENV=production
  </code></pre>
  
  <p>then I run <code>yarn run build</code> 
  and I do <code>git push heroku master</code></p>
  
  <p>this is the error Heroku is returning: </p>
  
  <pre><code>-----&gt; Node.js app detected
  
  -----&gt; Creating runtime environment
  
         NPM_CONFIG_LOGLEVEL=error
         NPM_CONFIG_PRODUCTION=false
         NODE_ENV=production
         NODE_MODULES_CACHE=true
         NODE_VERBOSE=false
  
  -----&gt; Installing binaries
         engines.node (package.json):  8.3.0
         engines.npm (package.json):   5.6.0
  
         Resolving node version 8.3.0...
         Downloading and installing node 8.3.0...
         Bootstrapping npm 5.6.0 (replacing 5.3.0)...
         npm 5.6.0 installed
  
  -----&gt; Building dependencies
         Installing node modules (package.json)
  
         &gt; nuxt@2.1.0 postinstall /tmp/build_f6a907d9d4fe0608ddfe9868e86cb3da/node_modules/nuxt
         &gt; opencollective || exit 0
  
         added 1142 packages in 32.448s
         Running heroku-postbuild
  
         &gt; sms-funnel@1.0.0 heroku-postbuild /tmp/build_f6a907d9d4fe0608ddfe9868e86cb3da
         &gt; npm run build &amp;&amp; npm start
  
  
         &gt; sms-funnel@1.0.0 build /tmp/build_f6a907d9d4fe0608ddfe9868e86cb3da
         &gt; nuxt build
  
         [18:55:29] vendor has been deprecated due to webpack4 optimization
         [18:55:29] Building project
         [18:55:29] Builder initialized
         [18:55:29] Nuxt files generated
  Nuxt Fatal Error :(
         [18:55:30] TypeError: Cannot read property 'stylus' of undefined
         at Builder.extend (/tmp/build_f6a907d9d4fe0608ddfe9868e86cb3da/nuxt.config.js:44:58)
         at WebpackClientConfig.extendConfig (/tmp/build_f6a907d9d4fe0608ddfe9868e86cb3da/node_modules/nuxt/dist/nuxt.js:3144:56)
         at WebpackClientConfig.extendConfig (/tmp/build_f6a907d9d4fe0608ddfe9868e86cb3da/node_modules/nuxt/dist/nuxt.js:3286:26)
         at WebpackClientConfig.config (/tmp/build_f6a907d9d4fe0608ddfe9868e86cb3da/node_modules/nuxt/dist/nuxt.js:3182:33)
         at WebpackClientConfig.config (/tmp/build_f6a907d9d4fe0608ddfe9868e86cb3da/node_modules/nuxt/dist/nuxt.js:3325:26)
         at Builder.webpackBuild (/tmp/build_f6a907d9d4fe0608ddfe9868e86cb3da/node_modules/nuxt/dist/nuxt.js:3922:56)
         at Builder.build (/tmp/build_f6a907d9d4fe0608ddfe9868e86cb3da/node_modules/nuxt/dist/nuxt.js:3632:16)
         at &lt;anonymous&gt;
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! sms-funnel@1.0.0 build: `nuxt build`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the sms-funnel@1.0.0 build script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /tmp/npmcache.nHcrE/_logs/2018-10-08T18_55_30_342Z-debug.log
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! sms-funnel@1.0.0 heroku-postbuild: `npm run build &amp;&amp; npm start`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the sms-funnel@1.0.0 heroku-postbuild script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /tmp/npmcache.nHcrE/_logs/2018-10-08T18_55_30_355Z-debug.log
  -----&gt; Build failed
  
         We're sorry this build is failing! You can troubleshoot common issues here:
         https://devcenter.heroku.com/articles/troubleshooting-node-deploys
  
         If you're stuck, please submit a ticket so we can help:
         https://help.heroku.com/
  
         Love,
         Heroku
  
   !     Push rejected, failed to compile Node.js app.
   !     Push failed
  </code></pre>
  
  <p>Inside my package.json under scripts I have: </p>
  
  <pre><code>"heroku-postbuild": "npm run build &amp;&amp; npm start"
  </code></pre>
  
  <p>This is my first time deploying a nuxt app, I want it to run with the middleware and express, so I do not want it to be a static site. Do I need to specify that its a web app somewhere? I'm following the heroku instructions but shouldn't I be only deploying the <code>.dist</code> folder that is generated after I run <code>yarn run build</code>?</p>
  
  <p>Here is my package.json: </p>
  
  <pre><code>{
    "name": "sms-funnel",
    "version": "1.0.0",
    "private": true,
    "scripts": {
      "dev": "nuxt",
      "build": "nuxt build",
      "start": "nuxt build &amp;&amp; nuxt start",
      "precommit": "npm run lint",
      "lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
      "heroku-postbuild": "npm run build &amp;&amp; npm start"
    },
    "dependencies": {
      "axios": "^0.16.2",
      "cross-env": "^5.0.1",
      "express": "^4.15.3",
      "fastclick": "^1.0.6",
      "fs": "^0.0.1-security",
      "gsap": "^2.0.2",
      "net": "^1.0.2",
      "nuxt": "latest",
      "source-map-support": "^0.4.15",
      "splitting": "^1.0.5",
      "stylus": "^0.54.5",
      "stylus-loader": "^3.0.2",
      "tls": "^0.0.1",
      "twilio": "^3.19.2",
      "vue-keyboard": "^3.1.0"
    },
    "engines": {
      "node": "8.3.0", 
      "npm": "5.6.0"
    },
    "devDependencies": {
      "babel-eslint": "^7.2.3",
      "eslint": "^4.3.0",
      "eslint-config-standard": "^10.2.1",
      "eslint-loader": "^1.9.0",
      "eslint-plugin-html": "^3.1.1",
      "eslint-plugin-import": "^2.7.0",
      "eslint-plugin-node": "^5.1.1",
      "eslint-plugin-promise": "^3.5.0",
      "eslint-plugin-standard": "^3.0.1"
    }
  }
  </code></pre>