ERROR: Heroku cannot find MongoDB (yelpcamp on The Web Developer Bootcamp 2022)

·

2 min read

This may be of help for someone else, at this point almost every package and app that Colt used during the course have changed. So when deploying I ran with several errors. (don't know really if they have to be with that)

First, remember to change the name of your app in both JSON files.

  • yelp-camp for yelpcamp

Since I keep having errors. I found the next answers on StackOverflow

After running Heroku and creating a new app you can use the next command to disable NODE_MODULES

$ heroku config:set NODE_MODULES_CACHE=false
$ git commit -am 'disable node_modules cache' --allow-empty
$ git push heroku main --<master> for IOS devices

or

You can write it on Config Vars, as Colt showed in this section. Web capture_27-11-2021_181913_dashboard.heroku.com.jpeg

If you still have errors and your app cannot run. (the same way it happened to me) Another solution is to include engines in package.json.

"engines": {
        "node": ">= 0.11.16", -- your current version*
 }

To know your current version, you just have to type in the command line

$ node --version

Not sure if this has a specific order, but it will look like this in your package.json

  "name": "yelpcamp",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "engines": {
    "node": ">=14.16.1" -- your current version
  },
...

Remember to commit and push changes in the Heroku app

$ git status
$ git add .
$ git commit -m "updating json files"
$git push heroku main --<master>for IOS

That worked for me, hopefully for you too. Let me know if you have any comments :3