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

package.json not found in directory - only in prod #57

Open
ndom91 opened this issue Jun 2, 2020 · 1 comment
Open

package.json not found in directory - only in prod #57

ndom91 opened this issue Jun 2, 2020 · 1 comment

Comments

@ndom91
Copy link

ndom91 commented Jun 2, 2020

So in development, the package.json info loads fine, as does the image and the rest of the about-window.

However, in prod I always get an error that about-window: package.json is not found in specified directory path: /opt/company/project/

When I cd /opt/company/project/ there is most definitely a package.json there.

Here is my openAboutWindow config:

openAboutWindow({
    icon_path: path.join(__dirname, '../resources/icons/256x256.png'),
    package_json_dir: path.join(__dirname, '../'),
    product_name: appInfo.name,
    bug_report_url: 'https://git.newtelco.dev/newtelco/billing-parser-1/issue',
    copyright: '2020 Newtelco GmbH',
    homepage: 'https://git.newtelco.dev',
    description: appInfo.description,
    license: appInfo.license,
    adjust_window_size: true,
    win_options: {
      resizable: false,
    },
    show_close_button: 'Close',
  })

I've tried defining the path with __dirname, process.cwd(), and various variations of going up and down directories to land back in the correct one.

Any idea what else I could be missing and/or doing wrong?!

EDIT: I'm also logging process.cwd() and __dirname right before this call and __dirname, for example, comes out to /opt/company/project/app, so a ../ brings one into the project root directoy, where a package.json most definitely is.. I see in the source code that its basically just concatenating package.json onto the path you pass into package_json_dir so I'm really not sure whats going wrong here.

@ndom91 ndom91 changed the title package.json not found in Dir, even though its definitely there.. package.json not found Jun 2, 2020
@ndom91 ndom91 changed the title package.json not found package.json not found in directory - only in prod Jun 2, 2020
@rhysd
Copy link
Owner

rhysd commented Jun 5, 2020

The error means require('/opt/company/project/package.json') fails. Open Electron as REPL and try require('/opt/company/project/package.json')

If you pack your app with asar, it may cause some issue

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