Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Heroku Application crashing on startup discordjs

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

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading