• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

109
Views
Electron Js Linux Built Not working when installed using snap

The code that I used to create desktop application is working locally. The app is about taking screen shot. When built using electron-builder it is building properly and creating AppImage and snap file for the app. Now my-app.AppImage file when open is working as expected. But the my-app.snap file when installed using snap is not running as expected. Below is the code in app.js

  ipcMain.on("start-share", function (event, arg) { 
    event.reply("uuid", "Screen Started"); // Not going further than this
    screenshot().then((img) => {
        try {
            event.reply("uuid", "Entered Screen Shot");
            let imgStr = Buffer.from(img).toString('base64');
            var obj = {};           
            obj.document_1 = imgStr;
            var url = 'http://some-url.com/api/workhub/test/task';
            axios.post(url, obj)
                .then((response) => {
                    // message = response.data;
                    event.reply("uuid", response.data);
                }).catch(error => {
                    event.reply("uuid", "Failed Catch Axios");
                }).finally(() => {

                });
        } catch (err) {
            event.reply("uuid", "Failed Try Catch Normal");
        }
    }).catch((err) => {
        event.reply("uuid", "Failed Catch Screen Shot");
    });
})

package.json file

  "name": "my-app",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "electron ."
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.27.2",    
    "screenshot-desktop": "^1.12.3"    
  },
  "devDependencies": {
    "electron": "^11.1.0"
  }
}
over 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error