0

I am attempting to get a Node app with MongoLab working on Heroku. I get the following message in my Heroku logs: "Error: Cannot find module './shared'". I have uninstalled and reinstalled node_modules several times and have also installed a "shared" module, to no avail. The app runs fine on localhost. Is there anything I'm missing?

eabates
  • 878
  • 1
  • 8
  • 22
  • Which modules do you require? – piscator Apr 26 '16 at 15:34
  • Hi, well----Express, Connect, Body-Parser, Logger, Path, Dotenv, Handlebars, Mongoose, Request, and Cheerio. – eabates Apr 26 '16 at 15:55
  • ./shared looks for the file shared.js in the directory of the file that requires it. So either you, or one of these packages is unable to find shared.js. Is there a shared.js file somewhere in your local environment? Does this file exist on your server as well? Did you commit all of the necessary files? Are all of these packages listed as dependencies in package.json? – piscator Apr 26 '16 at 18:03

1 Answers1

0

Just got the same issue. Seems you use latest node v6.0.0. Please check you use the latest npm on Heroku.

Check the following in your package.json: ... "engines": { "node": "6.0.0", "npm": "3.8.7" }, ...

Eugene Karasev
  • 116
  • 1
  • 6