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

I am not using electron version 26.6.7 still getting the error as mentioned in description when running the app #180

Open
nikunjjain-eaton opened this issue Mar 5, 2025 · 16 comments

Comments

@nikunjjain-eaton
Copy link

nikunjjain-eaton commented Mar 5, 2025

[1] App threw an error during load
[1] Error: The edge module has not been pre-compiled for Electron version 26.6.7 . You must build a custom version of edge.node. Please refer to https://github.com/agracio/electron-edge-js for building instructions.

Here is how i am using it.

import edge from 'electron-edge-js';

 const helloWorld = edge.func({
    assemblyFile: './MyLibrary.dll',
    typeName: 'MyLibrary.MyClass',
    methodName: 'HelloWorld',
  });

  helloWorld('Electron', function (error, result) {
    if (error) throw error;
    console.log(result); // Output: Hello, Electron!
  });
@nikunjjain-eaton nikunjjain-eaton changed the title I am not using electron version 26.6.7 still getting the same error when installing and using this libarary I am not using electron version 26.6.7 still getting the error as mentioned in description when running the app Mar 5, 2025
@agracio
Copy link
Owner

agracio commented Mar 5, 2025

What version of Electron is specified in your package.json?

Another way to find out is to remove all edge related code and have a single line

console.log(process.versions.electron);

@nikunjjain-eaton
Copy link
Author

What version of Electron is specified in your package.json?

Another way to find out is to remove all edge related code and have a single line

console.log(process.versions.electron);

it is showing 26.6.7 using console.log(process.versions.electron);

@agracio
Copy link
Owner

agracio commented Mar 5, 2025

Well then you are clearly using Electron 26

@nikunjjain-eaton
Copy link
Author

@agracio thanks for swift reply. Could you please guide me steps to generate precompiled for Electron version 26.6.7

@nikunjjain-eaton
Copy link
Author

nikunjjain-eaton commented Mar 5, 2025

Well then you are clearly using Electron 26

in my package.json electron version is
"electron": "^31.3.0",
"electron-builder": "^24.13.3",
"electron-devtools-installer": "^3.2.0",
"electronmon": "^2.0.2",
"eslint": "^8.49.0"
but with console you suggested it is showing 26.6.7

@agracio
Copy link
Owner

agracio commented Mar 5, 2025

Could you please guide me steps to generate precompiled for Electron version 26.6.7

Another user created this guide: #178
You will have to use it at your own risk electron-edge-js does not offer support for electron versions lower than 29
Electron foundation does no support Electron lower than version 33.

@agracio
Copy link
Owner

agracio commented Mar 5, 2025

in my package.json electron version is "electron": "^31.3.0", "electron-builder": "^24.13.3", "electron-devtools-installer": "^3.2.0", "electronmon": "^2.0.2", "eslint": "^8.49.0" but with console you suggested it is showing 26.6.7

Not sure what is going on in your package, did you run npm install?

@nikunjjain-eaton
Copy link
Author

Could you please guide me steps to generate precompiled for Electron version 26.6.7

Another user created this guide: #178 You will have to use it at your own risk electron-edge-js does not offer support for electron versions lower than 29 Electron foundation does no support Electron lower than version 33.

Thanks a lot for your response. I will check what is the issue at my end

@agracio
Copy link
Owner

agracio commented Mar 5, 2025

If you cannot figure it out at all then create a GitHub repo that reproduces the error.

@sagarhudge-eaton
Copy link

sagarhudge-eaton commented Mar 6, 2025

@agracio please find the code repository for the above issue, any help will be appropriated. In the above code I have tried all the steps from the #178 still having issue in execution

Error
The edge module has not been pre-compiled for Electron version 35.0.0. You must build a custom version of edge.node. Please refer to https://github.com/agracio/electron-edge-js for building instructions.

@agracio
Copy link
Owner

agracio commented Mar 6, 2025

electron-edge-js with Electron v35 support was published last night only a day after official 35 release. If you want to use v35 update to new version of electron-edge-js

@agracio
Copy link
Owner

agracio commented Mar 6, 2025

I am getting errors when running npm install at postinstall stage and then npm start also fails.
Some pointers about webpack and electron-builder configuration

@sagarhudge-eaton
Copy link

sagarhudge-eaton commented Mar 10, 2025

@agracio Thank you for providing a solution. The issue with the version has been resolved; however, we are now encountering the following error.

Additionally, could you provide an example? The example provided earlier does not seem to work for me.

my code in main.ts

the .dll file is place under the assets folder and path is given. The .dll file used is working file with node example but having issue with electron-edge-js

   const RESOURCES_PATH = app.isPackaged
   ? path.join(process.resourcesPath, 'assets')
   : path.join(__dirname, '../../assets');

   const getAssetPath = (...paths: string[]): string => {
   return path.join(RESOURCES_PATH, ...paths);
 };
    const callSdkMethod = edge.func({
    assemblyFile: dll_Path, 
    typeName: 'SDKWrapper.Person',
    methodName: 'GetData',
  });```

**ERROR**

```App threw an error during load
[1] Error: CoreClrEmbedding::Initialize - Could not find any runtimeconfig file ([appname].runtimeconfig.json in app folder nor dotnet.runtimeconfig.json in sdk folder)
[1]     at process.func [as dlopen] (node:electron/js2c/node_init:2:2559)
[1]     at Module._extensions..node (node:internal/modules/cjs/loader:1602:18)
[1]     at Object.func [as .node] (node:electron/js2c/node_init:2:2559)
[1]     at Module.load (node:internal/modules/cjs/loader:1295:32)
[1]     at Module._load (node:internal/modules/cjs/loader:1111:12)
[1]     at c._load (node:electron/js2c/node_init:2:16955)
[1]     at Module._load (/Users/e0658897/Desktop/Projects/CameraApp/node_modules/runtime-required/runtime-required.js:34:23)
[1]     at Module.require (node:internal/modules/cjs/loader:1318:19)
[1]     at require (node:internal/modules/helpers:179:18)
[1]     at Object.<anonymous> (/Users/e0658897/Desktop/Projects/CameraApp/node_modules/electron-edge-js/lib/edge.js:52:12)```

@agracio
Copy link
Owner

agracio commented Mar 10, 2025

This error will happen when you are running on a system with .NET Runtime installed but without .NET SDK.
On your dev system you should always have .NET SDK installed.
.NET 8.0
.NET 9.0

@sagarhudge-eaton
Copy link

sagarhudge-eaton commented Mar 10, 2025

Hi @agracio , I’m new to this and feeling quite stuck. I’d appreciate your guidance as I’m trying to go back to the basics.

  1. I have a .dll file that I’ve tested and loaded in a Node.js project.
  2. I’m now trying to use the same .dll file in an Electron project, following the snippet provided earlier.
  3. Do I still need to have .NET installed on the machine where the Electron app is running?

Are there any working examples of using electron-edge-js to import and work with a .dll file?

@agracio
Copy link
Owner

agracio commented Mar 10, 2025

The example is in the readme https://github.com/agracio/electron-edge-js-quick-start.
On your development PC you should have .NET SDK installed.

However if you are deploying your app from dev machine that has .NET SDK installed to one that only has .NET Runtime you will need to generate [appname].runtimeconfig.json file in your bin folder.
Add the following line to your .csproj properties:

<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>

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

3 participants