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
Uncaught Exception: Cannot find module ../package.json #58
Comments
You can use something like |
The problem is not on the user side, but on the library side, as it crashes executing the following line when the module is imported Line 10 in 6ad1a18
It requires a non-existing file based on the (not-necessarily true) assumption that package.json lies in the same folder of the program entry-point.
|
It may differ between the operation systems but |
I cannot reproduce the problem without knowing how your project is structured. Usually you define the entry point in the |
I think we can simplify the application logic by removing Line 10 in 6ad1a18
Line 11 in 6ad1a18
const mainFile = __filename It should work as |
Yes, using For completeness, I should mention that the |
So it turned out that |
For the records, 1.4.1 works for my setting. Thanks! |
NOTE: before openning an issue, please consult previous issues (both open and closed).
What is the problem
The module raises an exception:
How to reproduce
Include
require("electron-reload")(app.getAppPath() + "../renderer")
in the entrypoint of the program.Additional information
This happens with Electron 5.0.6
Apparently, getAppPath() points to the entry point of the program, which in this case is
/home/myuser/projects/myproject/main/main.js
. The problem is thatpackage.json
is in/home/myuser/projects/myproject/
not in/home/myuser/projects/myproject/main
. I see no way of specifying the relative path ofpackage.json
with respect togetAppPath()
The text was updated successfully, but these errors were encountered: