DEV Community

Muhammad
Muhammad

Posted on

NodeJS Deployment to Heroku Issue: Dependencies error

Sometimes we try to deploy a NodeJS app to Heroku and get an error regarding dependencies.

The exact issue is that there is a dependency we used during development by installing it globally (using npm install -g)

So now when we deploy the app to Heroku, there is an error.

The Solution:-

Simply, install whatever dependency you had installed globally as a dev dependency (using npm install -D) in your app before deploying app to Heroku. When done, now deploy the app to Heroku.

The dev dependency will do the same thing for production what a global dependency does during development.

It should now be deployed :) !

Top comments (0)