‘require’ statement in index.js causes error saying mailchimp module cannot be found

I’m using this API for a web app I’m making that uses mailchimp: Here’s the node.js API page

I’m also using this git repo to understand how to use the API: example repo

I cloned the repo, ran npm install express in the express directory of the repo, then ran node app

when I did that, I got this error: Error: Cannot find module './node_modules/mailchimp-api/mailchimp'

The require statement that names this module (in index.js) is:

var mcapi = require('./node_modules/mailchimp-api/mailchimp');

I checked the path, it should be correct. is there something I’m missing?


You need to run npm install in the express directory of the repo so that all of the modules are installed. You are missing the mailchimp module.

Leave a Reply

Your email address will not be published. Required fields are marked *