Error: Cannot find module '@heroku/buildpack-registry'

Viewed 3036

I am trying to deploy a web app on Heroku. I am getting the following error Error: Cannot find module '@heroku/buildpack-registry' I tried adding the version of node I am using but still didn't help. I also upgraded Heroku using npm i heroku@7.59.0 this too didn't help. Any thoughts on this?

This is my package.json

{"name":"gssrDB",
  "engines": {
    "node": "14.18.0"
  }
  ,
  "scripts": {
    "dev": "nodemon index.js",
    "start": "node index.js"
  },
  "dependencies": {
    "@heroku-cli/plugin-buildpacks": "^7.54.0",
    "@heroku/buildpack-registry": "^1.0.1",
    "async-file": "^2.0.2",
    "cli-ux": "^4.9.3",
    "dotenv": "^9.0.2",
    "ejs": "^3.1.6",
    "ejs-mate": "^3.0.0",
    "express": "^4.17.1",
    "got": "^8.3.2",
    "heroku": "^7.59.0",
    "mongodb": "^3.6.6",
    "mongoose": "^5.12.9",
    "nodemon": "^2.0.13",
    "phoenix": "^1.6.0"
  }
}

3 Answers

I solved it like this in terminal

$ heroku plugins:install buildpack-registry
$ heroku plugins:install buildpacks  

may be it works

I faced a similar problem, and I solved it by using proper node version. For the current heroku version, node16 works, otherwise it cause error in buildpack

Two things helped in fixing this:

  1. update the heroku CLI
    npm install -g heroku
    
  2. Adding the engines in the package.json with the currently installed node and npm versions
    "node": "14.18.0",
    "npm": "7.6.3"
    } 
    
Related