Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question about Heroku deployment #5

Closed
thehashrocket opened this issue Aug 28, 2013 · 5 comments
Closed

A question about Heroku deployment #5

thehashrocket opened this issue Aug 28, 2013 · 5 comments

Comments

@thehashrocket
Copy link

I keep receiving this error: "Error: Cannot find module 'models'" on Heroku.

I copied out the logs and put them in a gist due to length: https://gist.github.com/jshultz/9af05e8972f2eb4b1b76

Here's an excerpt:
2013-08-27T12:56:27.792568+00:00 app[web.1]: module.js:340
2013-08-27T12:56:27.791930+00:00 app[web.1]:
2013-08-27T12:56:27.792873+00:00 app[web.1]: throw err;
2013-08-27T12:56:27.792873+00:00 app[web.1]: ^
2013-08-27T12:56:27.794658+00:00 app[web.1]: at Function.Module._load (module.js:280:25)
2013-08-27T12:56:27.794658+00:00 app[web.1]: Error: Cannot find module 'models'

I setup my configs on Heroku and have a mongolab mongodb setup and the config val MONGO_URL is setup and the NODE_ENV is set to production.

It's running fine locally, just not when I deploy it. I was wondering if any of you have run across this before. After a lot of googling I'm just not sure what to do.

I posted this question to stackoverflow: http://l.jshultz.co/15wV6hf but no response yet. I thought I would turn to you experts. :)

@thehashrocket
Copy link
Author

Well, there's obviously more issues going on in this. I ended up adding ./lib/ in front of models, auth and boot. It was able to load the modules on Heroku, But, once I did that it found new errors: https://gist.github.com/jshultz/22a33a86da6d0841bcab

So, the question is: is it because there is a pathing issue when deployed to heroku or something else? Like I said, it works on my local machine but not when it goes to Heroku. It's a mystery.

@cristiandouce
Copy link
Collaborator

heroku config:set NODE_PATH=lib

@cristiandouce
Copy link
Collaborator

You should also set variables used in config/env.js.
And heroku config:set NODE_ENV=production in order to read env variables at heroku's deployment.

@thehashrocket
Copy link
Author

Thank you! That solved the issue. I appreciate it. :)

@rickyrauch
Copy link
Owner

@cristiandouce u monster of code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants