Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js app works locally but heroku says missing module

Tags:

I made a simple chat application using Node.JS and Socket.IO, everything works fine locally, but when I push it to heroku it gives me an application error, when I check the logs, this is the error:

Error: Cannot find module 'indexof'
    at Function.Module._resolveFilename <module.js:338:15>
    at Function.Module._load <module.js:280:25>
    at Module.require <module.js:364:17>
    at require <module.js:380:17>
    at Object.<anonymous> </app/node_modules/socket.io/node_modules/socket.io-parser/node_modules/emitter/index.js:6:13>
    at Module._compile <module.js:456:26>
    at Object.Module._extensions..js <module.js:474:10>
    at Module.load <module.js:356:32>
    at Functin.Module._load <module.js:312:12>
    at Module.require <module.js:364:17>

So I figured out that indexof is a module that Socket.IO uses, and it is in my node_modules folder, but for some reason either it's not being pushed to heroku or it's just not being recognized. I reinstalled my modules 5-6 times and recreated the app but it's still giving me the same error. My package.json file has 3 dependencies: Express, Socket.IO and Jade

like image 572
fiction Avatar asked Jun 02 '14 04:06

fiction


1 Answers

Alright so after 2 hours I figured the problem out, multiple folders named "emitter" that contained the indexof module also had a gitignore file that made git ignore the module, no idea why that was even there, but deleting them fixed the problem

like image 65
fiction Avatar answered Oct 14 '22 11:10

fiction