bennymeg / nx-electron

Electron schematics for nrwl nx platform
Apache License 2.0
307 stars 82 forks source link

Cannot run <app-name>-electron:make #247

Open solodov-dev opened 9 months ago

solodov-dev commented 9 months ago

Describe the bug After upgrading from v.13 to v.16 I cannot build the electron app.

Expected behavior Running nx run <app-name>-electron:make makes an electron executable.

Desktop (please complete the following information):

Additional context I've been assigned to an existing project which uses nx, react and electron. The project was running nx 13. I've upgraded everything to v.16. Nx electron was upgraded to v16.0.0-beta.1.

After upgrading I cannot run nx run <app-name>-electron:make. I am getting this error: ENOENT no such file or directory '/home/<user>/code/<project-dir>/dist/packages/<app-name>-electron/index.js'.

The electron:build command creates a folder dist/apps/<app-name>-electron and not the dist/packages... folder. Also there is no index.js file in the dist/apps/<app-name>-electron folder, but a main.js file instead. I understand that I have to set some options for the electron:make command, but setting these options in maker.options.json doesn't help.

 "directories":{
    "app": "apps/<app-name>-electron",
    "buildResources": "apps/<app-name>-electron"
  },

Any help would be appreciated ( I'm trying to build this thing for 3 days already

6matko commented 9 months ago

Have the same issue.

octadecimal commented 7 months ago

For both your renderer and main electron projects, try adjusting the outputPath field of project.json in both projects to be something like:

    "outputPath": "dist/apps/myproject-electron",

instead of:

    "outputPath": "dist/apps/myproject/electron",

That way they're both emitting to the root dist/apps directory without any further nesting. I'm not sure if it's the same issue you're having, but it sounds similar. I needed to do this in order for :make to work.