Search code examples
herokuheroku-nodejs

Postinstall not getting NODE_ENV


When I deploy my node app to the Heroku, after it's done installing its dependancies, it does an "npm run postinstall" as per the docs, however the NODE_ENV variable isn't set, so my app is being build in development mode.

Simple solution would be to add NODE_ENV=production to the front, but this would cause issues when deploying to staging. Their documentation says that the variable should be set, but it's not. What am I missing?

Thanks!


Solution

  • You can simply go to heroku and set the NOD_ENV variable by doing the following in your terminal:

    heroku config:set NODE_ENV=production
    

    Or you can simply go to heroku settings and set the config vars.