5

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

3
  • is it installed locally or globally ? To see global packages do npm list -g for local npm list Commented Apr 17, 2013 at 17:23
  • I don't understand your question. I'm trying to run my app on heroku. Commented Apr 17, 2013 at 22:08
  • how did you install package csv Commented Apr 18, 2013 at 2:09

1 Answer 1

5

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. They can only be 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 into your 'node_modules' folder.

Then if you re-deploy your app to heroku it should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.