Click here to Skip to main content
15,886,774 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I get a Syntax Error 800A03EA Electron

code var <
// const { app, BrowserWindow } = require('electron')

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

//   win.loadFile('public/index.html')

// }

// app.whenReady().then(() => {
//   createWindow()
// })

//printen met electron
//electron electron.js bg.js
//To open DevTools, use the shortcut "Ctrl+Shift+I" or the <F12> key
const { app, BrowserWindow, ipcMain } = require("electron")



const url = require("url")
const path = require("path")


// const printer = require('ZDesigner ZD420-203dpi ZPL')

let mainWindow;

function createWindow() {
  mainWindow = new BrowserWindow({
    width: 1280,
    height: 1024,

    // fullscreen: true,
    autoHideMenuBar: true,

    webPreferences: {
      nodeIntegration: true,
      contextIsolation: true,
      preload: path.join(__dirname, "electron-preload.js"),
    },
  });

  mainWindow.loadURL(
    url.format({
      pathname: path.join(__dirname, `./dist/index.html`),
      protocol: "file:",
      slashes: true,
    })
  );
  mainWindow.on("closed", function() {
    mainWindow = null;
  });
}
console.log(app);
app.on("ready", createWindow);

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

app.on("activate", function() {
  if (mainWindow === null) createWindow();
});

//USBPRINT\ZEBRA_TECHNOLOGIES_ZTC_ZD420-203DPI_ZPL\6&18DADFD0&1&USB001
const printer = require('printer')

const zpl = this.base64DecodeUnicode(this.$store.state.allDocumentInfo.content)

      
const printerName = 'ZDesigner ZD420-203dpi ZPL'

//node-gyp clean configure build --verbose --arch=x64
//yarn add electron-rebuild --arch=x64
ipcMain.on("toMain", (event, args) => {
  console.log(event, args);
 

      printer.printDirect({
        type: "RAW",
        printer: printerName,
        data: zpl,
        succes: function(jobId){
          console.log("create print job" + jobId)
        },
        error: function(err){
          console.log(err)
        }
      })
});


>

What I have tried:

I have tried all possible solutions to fix my syntax, but i can't see my syntax error. I am new to electron and would appreciate the help.
Posted
Updated 3-Jun-21 21:58pm
Comments
Yannic Hamers 4-Jun-21 4:13am    
yeah and I have deleted my node_modules, package-lock-json and installed it all over again. I get the error that there is something wrong with the syntax. So I guess it has something to do with my syntax. Maybe a token mistake somewhere
Richard MacCutchan 4-Jun-21 5:35am    
pathname: path.join(__dirname, `./dist/index.html`),
Are you sure that '.' is valid in the path?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900