Heroku install nod modules with --only=prod option, so it won't install devDependencies.
Since our dotenv is required at index.js, the server fail to load.
Error: Cannot find module 'dotenv'
Proposed solution
One of the options bellow:
Move dotenv to dependencies or
add a try {} catch block around it on backend/index.js
Problem description
Heroku install nod modules with
--only=prod
option, so it won't installdevDependencies
. Since ourdotenv
is required atindex.js
, the server fail to load.Proposed solution
One of the options bellow:
dependencies
ortry {} catch
block around it onbackend/index.js