0

I've made a simple notes app using HTML, CSS and Javascript, and now i want to turn it into a desktop application, i'm using the Electron framework to achieve it, but for some reason i can't launch the application for testing purposes.

i typed "npm start" on the code editor terminal to launch the application, but instead it outputs the following log:

> [email protected] start
> electron .

[17011:0428/235408.856171:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[17011:0428/235408.946582:ERROR:ozone_platform_x11.cc(244)] Missing X server or $DISPLAY
[17011:0428/235408.946601:ERROR:env.cc(258)] The platform failed to initialize.  Exiting.
/workspaces/Notes-App/node_modules/electron/dist/electron exited with signal SIGSEGV

Additional information (if useful). the main.js file is on the root directory of the project, and the HTML, CSS and Javascript of the website is on a folder called "src" on the root directory, as this screenshot shows:

enter image description here

Main.js code:

const { app, BrowserWindow } = require('electron');

function createWindow() {
    const win = new BrowserWindow({
        width: 800,
        height: 600,
    });

    win.loadFile('src/index.html');
}

app.whenReady().then(createWindow);

app.on('window-all-closed', () => {
    if (process.platform !== 'darwin') app.quit();
})

script.js code (the code that saves the notes app text on browser):

var textarea = document.querySelector('textarea');

textarea.addEventListener("input", function () {
    var textWritten = textarea.value;
    localStorage.setItem("written", textWritten);
});

var written = localStorage.getItem("written");

if (written) {
    textarea.value = written;
}
2
  • Looks like you are trying to run GUI based application on a Linux machine that does not have any Display (X server)
    – Vinay
    Commented Apr 29 at 16:08
  • OBS: i'm on Windows 10.
    – Kevin
    Commented Apr 29 at 21:39

0