Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

330
Views
App works locally but not on Heroku (Application Error); Using Nodemon and Webpack

Alright, I've tried to look up my question on StackOverflow but I can't find something that helps me since everything I've tried doesn't have any effect on the result (Application error).

So I'm really stumped because the app works perfectly fine on my localhost, but I can't get it to work on Heroku, it just gives me a Application error so I have no idea what the issue is.

So on my package.JSON file looks like this:

"main": "index.js",
  "scripts": {
  "test": "echo \"Error: no test specified\" && exit 1",
  "start": "nodemon --use_strict index.js",
  "bundle": "webpack"
},

And I've already tried to change "nodemon" to "node" and gotten rid of --use_strict and ran it on local host and it still works perfectly fine but the Heroku app still gives me a Application Error.

index.js the only thing that I can think of being bad (changed it and it runs here):

// start the server
app.listen(3000, () => {
  console.log('Server is running.');
});

webpack.config.js:

const path = require('path');


module.exports = {
  // the entry file for the bundle
  entry: path.join(__dirname, '/client/src/app.jsx'),

  // the bundle file we will get in the result
  output: {
    path: path.join(__dirname, '/client/dist/js'),
    filename: 'app.js',
  },

  module: {

    // apply loaders to files that meet given conditions
    loaders: [{
      test: /\.jsx?$/,
      include: path.join(__dirname, '/client/src'),
      loader: 'babel-loader',
      query: {
        presets: ["react", "es2015"]
      }
    }],
  },

  // start Webpack in a watch mode, so Webpack will rebuild the bundle on changes
  watch: true
};

It deployed properly after git push heroku master: https://c1.staticflickr.com/3/2873/33519283263_3d9a711311_z.jpg

I'm pretty much trying to make this app work on Heroku: https://vladimirponomarev.com/blog/authentication-in-react-apps-creating-components

I think a possible problem might be that you have to run "run bundle" on one shell and "npm start" in the other shell.

Another thing, this app had a lot of things that were npm installed manually in node_modules, which Heroku does not accept if I try to push it on github and will crash, so I'm thinking that might be an issue as well, though I have no idea how to get around that.

This also uses Express and Mongodb, and I added my mongodb info into the index.json file and ran the application, and it worked perfectly fine and after checking the db, the correct info was also inside it, so it's not that either.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You should use process.env.PORT instead of custom port 3000.

Check that you have a mongodb addon purchased, you can get one for free but for limited spacing!

And use the config vars of that database, if you haven't done that already!

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!