Heroku Deployment Pitfall: Nodemon and Other Dependencies

02/12/20191 Min Read — In DevTools, Node.js

Heroku doesn't deploy your dev dependencies. This sounds like a good thing. But when you develop Node.js with Nodemon and your package.json uses nodemon as a start script, things can go haywire with Heroku.

Easy fix: change your entry in package.json back from nodemon to node.

"scripts": {
    "start": "node server.js" // instead of: "nodemon server.js"

Also, check your other dependencies. Sometimes you might switch other packages from dev to normal dependencies, too.

For example, I used knex.js for PostgreSQL interop and installed it as a dev dependency first. That was wrong and naturally didn't work with Heroku.

Further Reading