I'm using a common node package 'csv' to do CSV parsing. It works great on my local mac, but not on heroku. In the "heroku log", I get Cannot find module 'csv'.
Yes, I have it in my package json file:
{
"name":"rimes",
"version":"0.0.1",
"dependencies":{
"sys":"",
"url":"",
"http":"",
"querystring":"",
"oauth":"0.9.10",
"fs":"",
"csv":"0.3.0",
"request":"",
"node-cache":"",
"underscore":""
}
}
and I require it in my app.js
var sys = require('sys'),
http = require('http'),
url = require('url'),
qs = require('querystring'),
OAuth= require('oauth').OAuth,
fs = require('fs'),
csv = require('csv'),
myreq = require('request'),
NodeCache = require('node-cache'),
us = require('underscore');
What can I do to fix this on heroku?
Thank you, ~Todd
So when you require packages on node, you also need to install them in your node_modules folder. They must be in the node_modules folder as well as "required" in your code and declared in your "package.json."
If you go into your project directory (the file where package.json is located) and run:
npm install
it should install your missing dependencies in your 'node_modules' folder.
Then if you re-deploy your app to heroku it should work.