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

Problem when the working directory is not the app directory #53

Closed
Gregoire-M opened this issue Mar 20, 2013 · 3 comments
Closed

Problem when the working directory is not the app directory #53

Gregoire-M opened this issue Mar 20, 2013 · 3 comments

Comments

@Gregoire-M
Copy link

Hi,

I've a problem with the uptime app, related to the config module.

I'd like to run uptime as a service on my Ubuntu 12.04 server, but my problem is that I can't launch the app from anywhere on my server. It seems that I need to be in the uptime directory, otherwise I get this error:

$ /usr/local/bin/node /var/www/uptime/app.js
Cannot write runtime.json file Error: ENOENT, no such file or directory '/home/gregoire/config/runtime.json'

fs.js:837
    throw errnoException(errno, 'watch');
          ^
Error: watch ENOENT
    at errnoException (fs.js:806:11)
    at FSWatcher.start (fs.js:837:11)
    at Object.fs.watch (fs.js:861:11)
    at Config.watchForConfigFileChanges (/var/www/uptime/node_modules/config/lib/config.js:468:37)
    at /var/www/uptime/node_modules/config/lib/config.js:1089:20
    at Module._compile (module.js:420:14)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)

It searches "config/runtime.json" in the working directory instead of searching it in the application root directory.
Is it a behavior that you can fix?

Thanks.

PS: the issue on uptime's repo fzaninotto/uptime#123

@lorenwest
Copy link
Collaborator

Hi Grégoire,

The $NODE_CONFIG_DIR environment variable is there to help. Normally node-config looks into the ./config directory of the running application. In cases where you need more control, it first checks the $NODE_CONFIG_DIR environment variable. Just set it before running your app, and you should be good.

Uptime looks very cool. Hope this helps!

-Loren

@Gregoire-M
Copy link
Author

Okay, thank you for this trick!

@ghost
Copy link

ghost commented Aug 12, 2013

Good to know 👍

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

2 participants