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

Sharp not working as expected with electron-packager #2813

Closed
manankarani opened this issue Jul 26, 2021 · 1 comment
Closed

Sharp not working as expected with electron-packager #2813

manankarani opened this issue Jul 26, 2021 · 1 comment
Labels

Comments

@manankarani
Copy link

I am creating an electron app, which on npm start works perfectly, but when I try to build the same with the electron-packager, the following error pops on on clicking the exe file.

A JavaScript error occurred in the main process
Uncaught Exception
Error
Something went wrong installing the "sharp"module
The specified module could not be found.

my package.json :

  "name": "manan",
  "version": "1.0.0",
  "description": "A minimal Electron application",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "pack": "electron-builder --dir",
    "dist": "electron-builder",
    "buildWin": "electron-packager . WhatsBulker --platform=win32 --arch=x64 --electronVersion=13.1.7 --app-version=1.0.0 --build-version=2.0.0 --prune=false --overwrite=true && electron ./package.js"
  },
  "author": "manan",
  "devDependencies": {
    "electron": "^13.1.7",
    "electron-builder": "^22.11.7",
    "electron-winstaller": "^5.0.0"
  },
  "dependencies": {
    "body-parser": "^1.19.0",
    "ejs": "^3.1.6",
    "electron-store": "^8.0.0",
    "express": "^4.17.1",
    "jquery": "^3.6.0",
    "multer": "^1.4.2",
    "node-fetch": "^2.6.1",
    "underscore": "^1.13.1",
    "venom-bot": "^3.0.21",
    "xlsx": "^0.17.0"
  }
}

Environment Details:

System:
    OS: Windows 10 10.0.22000 //(Windows 11 Dev Channel)
    CPU: (8) x64 Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz
    Memory: 764.69 MB / 7.88 GB
  Binaries:
    Node: 14.17.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 7.17.0 - ~\node_modules\.bin\npm.CMD

Here I am using venom-bot which has internal dependency of the sharp module.

my build command :
electron-packager . WhatsBulker --platform=win32 --arch=x64 --electronVersion=13.1.7 --app-version=1.0.0 --build-version=2.0.0 --prune=false --overwrite=true && electron ./package.js

package.js (used to produce a installer):

var installer = require('electron-winstaller');
var path      = require('path');
const dialog  = require('electron').dialog;

console.log("packaging into a exe...\n");
resultPromise = installer.createWindowsInstaller({
    appDirectory:    './AppName-win32-ia32',
    outputDirectory: './installers/final',
    exe:             'AppName.exe',
    setupExe:        'FinalExeName.exe',
    noMsi:           true,
    iconUrl:         'IconUrl',
    setupIcon:       'IconPath'
});

resultPromise.then(function () {
    console.log("Installer created");
    dialog.showMessageBox({
        type:    'info',
        title:   'electron-winstaller',
        message: "Installer created",
        buttons: ['ok']
    });
    require('electron').app.quit();
});

Sharp Version : sharp@0.28.3
Latest Version : sharp@0.28.3

Please help if anyone has figured out my problem. Thanks.

@lovell
Copy link
Owner

lovell commented Jul 27, 2021

This is probably the same as #2764. The combo of Windows + Node-API + electron-rebuild isn't quite supported by Electron.

@lovell lovell added question and removed triage labels Jul 27, 2021
@lovell lovell closed this as completed Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants