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

keytar.node: invalid ELF header everytime I make a build #8737

Open
GeorgeFlorian opened this issue Dec 11, 2024 · 1 comment
Open

keytar.node: invalid ELF header everytime I make a build #8737

GeorgeFlorian opened this issue Dec 11, 2024 · 1 comment

Comments

@GeorgeFlorian
Copy link

GeorgeFlorian commented Dec 11, 2024

    "electron": "^32.1.2",
    "electron-builder": "^25.1.7",
    "electron-rebuild": "^3.2.9",

I run the dev build on my Linux Machine: "dev": "npx electron-rebuild && concurrently \"npm run dev:vite\" \"npm run dev:electron\"", and I build for Windows "dist": "rm -rf dist dist_electron && npm run build && electron-builder --win",

  "build": {
    "appId": "com.ceva.automat-plata-parcare",
    "productName": " Automat Plata Parcare",
    "directories": {
      "output": "dist_electron",
      "buildResources": "build"
    },
    "files": [
      "dist/**/*",
      "electron/**/*",
      "build/**/*"
    ],
    "win": {
      "target": "portable",
      "icon": "build/m_icon.ico",
      "artifactName": "Automat-Plata-Parcare-${version}.exe",
      "executableName": "Automat Plata Parcare.exe"
    }
  },

After every build I get Error: /home/george/Projects/automat-parcare-kiosk/node_modules/keytar/build/Release/keytar.node: invalid ELF header and I have to delete node_modules and reinstall them.

npx electron-rebuild does nothing to fix my issue.

I use keytar in electron/main.js:

import keytar from 'keytar';

ipcMain.handle('set-password', async (_, password) => {
  try {
    await keytar.setPassword(SERVICE_NAME, ACCOUNT_NAME, password);
    return { success: true };
  } catch (error) {
    console.error('Failed to set password:', error);
    return { success: false, error: error.message };
  }
});

ipcMain.handle('get-password', async () => {
  try {
    const password = await keytar.getPassword(SERVICE_NAME, ACCOUNT_NAME);
    return { success: true, password };
  } catch (error) {
    console.error('Failed to retrieve password:', error);
    return { success: false, error: error.message };
  }
});
app.whenReady().then(async () => {
  // await keytar.deletePassword(SERVICE_NAME, ACCOUNT_NAME);
  const password = await keytar.getPassword(SERVICE_NAME, ACCOUNT_NAME);
  const configExists = fs.existsSync(configFilePath);

  const initialRoute = !password || !configExists ? '/settings' : '/';
  createWindow(initialRoute);
});
@mmaietta
Copy link
Collaborator

mmaietta commented Jan 3, 2025

Can you try next npm tag of electron-builder? Also, it is recommended to not install electron-rebuild directly as electron-builder has it already as a dependency.

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