0
2022-03-13T12:28:53.072745+00:00 app[worker.1]: node:internal/modules/cjs/loader:1183
2022-03-13T12:28:53.072757+00:00 app[worker.1]:   return process.dlopen(module, path.toNamespacedPath(filename));
2022-03-13T12:28:53.072757+00:00 app[worker.1]:                  ^
2022-03-13T12:28:53.072758+00:00 app[worker.1]: 
2022-03-13T12:28:53.072758+00:00 app[worker.1]: Error: /app/node_modules/canvas/build/Release/canvas.node: invalid ELF header
2022-03-13T12:28:53.072758+00:00 app[worker.1]:     at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
2022-03-13T12:28:53.072759+00:00 app[worker.1]:     at Module.load (node:internal/modules/cjs/loader:975:32)
2022-03-13T12:28:53.072759+00:00 app[worker.1]:     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
2022-03-13T12:28:53.072759+00:00 app[worker.1]:     at Module.require (node:internal/modules/cjs/loader:999:19)
2022-03-13T12:28:53.072760+00:00 app[worker.1]:     at require (node:internal/modules/cjs/helpers:102:18)
2022-03-13T12:28:53.072760+00:00 app[worker.1]:     at Object.<anonymous> (/app/node_modules/canvas/lib/bindings.js:3:18)
2022-03-13T12:28:53.072760+00:00 app[worker.1]:     at Module._compile (node:internal/modules/cjs/loader:1099:14)
2022-03-13T12:28:53.072761+00:00 app[worker.1]:     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
2022-03-13T12:28:53.072761+00:00 app[worker.1]:     at Module.load (node:internal/modules/cjs/loader:975:32)
2022-03-13T12:28:53.072761+00:00 app[worker.1]:     at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
2022-03-13T12:28:53.072762+00:00 app[worker.1]:   code: 'ERR_DLOPEN_FAILED'
2022-03-13T12:28:53.072762+00:00 app[worker.1]: }
2022-03-13T12:28:53.072766+00:00 app[worker.1]: 
2022-03-13T12:28:53.072766+00:00 app[worker.1]: Node.js v17.7.1
2022-03-13T12:28:53.205192+00:00 heroku[worker.1]: Process exited with status 1

Whenever I start my heroku application it crashes with the error above I cant figure out why its doing this, the bot works completely fine running it off vscode

1 Answers1

1

According to this question => Simple REST app working in local but not in heroku, the error happens because you have committed the node_modules folder to your repository. The node_modules folder contains all the modules you install, and some of them are incompatible with Heroku. So all you have to do is remove it from your repository and untrack the node_modules folder by doing:

git rm -r --cached node_modules
git commit -m "Remove node_modules from repository"
git push heroku master
Zsolt Meszaros
  • 21,961
  • 19
  • 54
  • 57
Caladan
  • 2,261
  • 2
  • 6
  • 19
  • this did resolve the issue but now im getting this error saying i dont have module 'colors' https://pastebin.com/Vyy9yvCx –  Mar 13 '22 at 12:44
  • This should be a comment, not an answer. If it is a duplicate question, [vote to close](https://stackoverflow.com/help/privileges/close-questions) as such and/or leave a comment once you earn enough reputation. If it's not a duplicate, tailor the answer to this specific question. – Zsolt Meszaros Mar 13 '22 at 12:45
  • That happens because there is no module called `colors` in your `package.json` file. So all you have to do is `npm install colors --save` – Caladan Mar 13 '22 at 12:47