-
Notifications
You must be signed in to change notification settings - Fork 459
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
App fails to start if not invoked from the app root. #55
Comments
FYI: Accessing the main module Also, consider that this breaks down when process managers are involved. For example, when using PM2 the main module is not the file you think it is. Additionally, this was built to start in the current directory and traverse upward, looking for a valid kraken application to support the experimental mounting of apps. If you'll notice, it explicitly DOESN'T use process.cwd(), but starts with the current file location (inside EDIT: It doesn't use process.cwd() unless a valid kraken app isn't found. If there's a bug, it might be there. |
Yep, I was just going to point out what you edited. The parameter being passed by Because of this, I don't think this condition will evaluate to true during the loop, so it eventually stops when there are no more modules to traverse ( At this point, since On my solution, I had not considered other startup methods for the app, so good callout. Will continue looking at this tomorrow. |
|
Also, is pm2 the recommended way to deploy kraken to a live server? Do you prefer it over, say, node-forever? And are there other such tools worth considering as well? |
The rub here is composition. If I create a kraken application and publish it as a module, depending on the version of kraken I depend on, I may have my own "application root" (with my own copy of kraken, templates, etc.) which is in a nested directory of the actual application root, but this nested directory (within the top level Also, pm2 isn't necessarily the recommended solution, but it's an example of a situation where a script or application runner defines an alternate |
Is this an issue anymore as of |
Nope... |
eg: App lives in
~/dev/myApp/index.js
If I invoke the app from a different directory it fails:
eg:
~dev $ node myApp/index.js
Solution (PR to be submitted later)
This line
this._config = config.create(this._resolve('.'));
could be changed to
this._config = config.create(this._resolve(path.dirname(process.argv[1])));
To reflect the true root of the app, as opposed to the current working directory.
The text was updated successfully, but these errors were encountered: