0

When trying to deploy my website, the Heroku application page displays an error and says that it does not recognize my default language, but my organization seems fine. Can anyone take a look and help me?

The error message says the following: -----> Building on the Heroku-20 stack -----> Determining which buildpack to use for this app No default language could be detected for this app. HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically. See https://devcenter.heroku.com/articles/buildpacks Push failed

My app.js file is in the root directory, and I have my package.json and package-lock.json, as well as my node-modules folder all removed from my .gitignore file.

Here are the error messages:

2022-04-14T19:38:04.000000+00:00 app[api]: Build succeeded
2022-04-14T19:38:04.403709+00:00 heroku[web.1]: State changed from crashed to starting
2022-04-14T19:38:07.012016+00:00 heroku[web.1]: Starting process with command `node app.js`
2022-04-14T19:38:08.196172+00:00 app[web.1]: node:internal/modules/cjs/loader:1187
2022-04-14T19:38:08.196191+00:00 app[web.1]: return process.dlopen(module, path.toNamespacedPath(filename));
2022-04-14T19:38:08.196192+00:00 app[web.1]: ^
2022-04-14T19:38:08.196193+00:00 app[web.1]:
2022-04-14T19:38:08.196193+00:00 app[web.1]: Error: /app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header
2022-04-14T19:38:08.196193+00:00 app[web.1]: at Object.Module._extensions..node (node:internal/modules/cjs/loader:1187:18)
2022-04-14T19:38:08.196194+00:00 app[web.1]: at Module.load (node:internal/modules/cjs/loader:981:32)
2022-04-14T19:38:08.196194+00:00 app[web.1]: at Function.Module._load (node:internal/modules/cjs/loader:822:12)
2022-04-14T19:38:08.196194+00:00 app[web.1]: at Module.require (node:internal/modules/cjs/loader:1005:19)
2022-04-14T19:38:08.196195+00:00 app[web.1]: at require (node:internal/modules/cjs/helpers:102:18)
2022-04-14T19:38:08.196195+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/bcrypt/bcrypt.js:6:16)
2022-04-14T19:38:08.196195+00:00 app[web.1]: at Module._compile (node:internal/modules/cjs/loader:1103:14)
2022-04-14T19:38:08.196195+00:00 app[web.1]: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
2022-04-14T19:38:08.196196+00:00 app[web.1]: at Module.load (node:internal/modules/cjs/loader:981:32)
2022-04-14T19:38:08.196196+00:00 app[web.1]: at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
2022-04-14T19:38:08.196196+00:00 app[web.1]: code: 'ERR_DLOPEN_FAILED'
2022-04-14T19:38:08.196197+00:00 app[web.1]: }
2022-04-14T19:38:08.335707+00:00 heroku[web.1]: Process exited with status 1
2022-04-14T19:38:08.558508+00:00 heroku[web.1]: State changed from starting to crashed
2022-04-14T19:38:08.568734+00:00 heroku[web.1]: State changed from crashed to starting
2022-04-14T19:38:11.169221+00:00 heroku[web.1]: Starting process with command `node app.js`
2022-04-14T19:38:12.704658+00:00 app[web.1]: node:internal/modules/cjs/loader:1187
2022-04-14T19:38:12.704668+00:00 app[web.1]: return process.dlopen(module, path.toNamespacedPath(filename));
2022-04-14T19:38:12.704669+00:00 app[web.1]: ^
2022-04-14T19:38:12.704669+00:00 app[web.1]:
2022-04-14T19:38:12.704670+00:00 app[web.1]: Error: /app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header
2022-04-14T19:38:12.704670+00:00 app[web.1]: at Object.Module._extensions..node (node:internal/modules/cjs/loader:1187:18)
2022-04-14T19:38:12.704671+00:00 app[web.1]: at Module.load (node:internal/modules/cjs/loader:981:32)
2022-04-14T19:38:12.704671+00:00 app[web.1]: at Function.Module._load (node:internal/modules/cjs/loader:822:12)
2022-04-14T19:38:12.704671+00:00 app[web.1]: at Module.require (node:internal/modules/cjs/loader:1005:19)
2022-04-14T19:38:12.704671+00:00 app[web.1]: at require (node:internal/modules/cjs/helpers:102:18)
2022-04-14T19:38:12.704672+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/bcrypt/bcrypt.js:6:16)
2022-04-14T19:38:12.704672+00:00 app[web.1]: at Module._compile (node:internal/modules/cjs/loader:1103:14)
2022-04-14T19:38:12.704672+00:00 app[web.1]: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
2022-04-14T19:38:12.704672+00:00 app[web.1]: at Module.load (node:internal/modules/cjs/loader:981:32)
2022-04-14T19:38:12.704672+00:00 app[web.1]: at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
2022-04-14T19:38:12.704673+00:00 app[web.1]: code: 'ERR_DLOPEN_FAILED'
2022-04-14T19:38:12.704673+00:00 app[web.1]: }
2022-04-14T19:38:12.850732+00:00 heroku[web.1]: Process exited with status 1
2022-04-14T19:38:12.964458+00:00 heroku[web.1]: State changed from starting to crashed

File Hierarchy

Error message 1

Error message 2

  • 2
    `my node-modules folder all removed from my .gitignore file` Put it back. The error you're getting indicates you've got Node modules from the wrong architecture. Don't check your `node_modules` into the Git repository; let Heroku install them automatically from the `package-lock.json` file, which will ensure it gets the correct ones for Heroku's architecture. – ceejayoz Apr 14 '22 at 19:50
  • More to the point, your `package.json` and `package-lock.json` must be in the root directory of your project. It looks like they're in a `views/` directory, though it's not entirely clear. – ChrisGPT was on strike Apr 14 '22 at 21:00
  • 1
    Actually, you seem to be showing two unrelated sets of errors: "no default language could be detected" means your `package.json` and `package-lock.json` aren't being found in the right place, the other errors in your code block are _runtime_ errors that happen after a successful deployment. Which errors are you actually trying to resolve at the moment? – ChrisGPT was on strike Apr 14 '22 at 21:02
  • It seems that the error about the default language went away after I reinstalled the buildpack modules. Can you help me solve the runtime errors? @Chris – Soham Katdare Apr 15 '22 at 13:58
  • @SohamKatdare The `invalid ELF header` error is because you've included `node_modules` in the repository. Add it back to `.gitignore`, remove the folder from your repo (https://stackoverflow.com/questions/1143796/remove-a-file-from-a-git-repository-without-deleting-it-from-the-local-filesyste), and let Heroku install the Node modules as part of the deployment process. – ceejayoz Apr 15 '22 at 20:09
  • The error `'ERR_DLOPEN_FAILED'` is solvable. Try [this solution here](https://stackoverflow.com/a/71027574/9448032) – eManuel May 29 '22 at 20:04

0 Answers0