久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

將 console.log() 與電子一起使用

using console.log() with electron(將 console.log() 與電子一起使用)
本文介紹了將 console.log() 與電子一起使用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我已經看到很多人試圖從渲染過程中控制日志,這不是我的問題我有 console.log 亂扔我的主要代碼,我在控制臺中看不到任何東西這是我的代碼.

I have seen a lot of questions from people trying to console log from the rendering process, this is NOT my problem I have console.log littering my main code and I don't see anything in my console here is my code.

/* eslint-disable no-undef */
const { app, BrowserWindow, ipcMain } = require('electron');
const path = require('path');
const url = require('url');
/* eslint-enable */

let win;

console.log('console log test');

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

  win.loadURL(url.format({
    pathname: path.join(__dirname, 'index.html'),
    protocol: 'file:',
    slashes: true
  }));

  win.on('close', () => {
    win = null;
  });

  console.log('console log test');
}

app.on('ready', createWindow);

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

app.on('activate', () => {
  if (win == null) {
    console.log('console log test');
    createWindow();
    console.log('console log test');
  }
});

除了電子本身產生的日志之外,我沒有看到任何日志我嘗試拋出錯誤并且這些工作正常,但是任何與控制臺相關的東西都不起作用,我嘗試在 PowerShell 中運行它并從 GitHub 重新拉取,我的朋友在拉取項目時可以看到控制臺日志雖然如此看來我是孤立的.我還更新了 NPM 和與項目相關的所有模塊,并且我嘗試創建一個新控制臺并登錄到該控制臺,但它似乎沒有出現,我錯過了什么嗎?我已經為此投入了數小時,并準備放棄.

I don't see a single log other than the ones produced by electron itself I've tried throwing errors and those work fine but anything console.* related doesn't work at all, I've tried running it in PowerShell and re-pulling from GitHub, my friend can see the console logs when he pulls the project though so it seems I'm isolated. I've also updated NPM and all modules associated with the project AND I've tried creating a new console and logging to that one but it doesn't seem to show up, am I missing something? I've put hours into this and am ready to give up.

推薦答案

我感覺到你的痛苦.我的一個盒子(一個 Server2012 盒子)有這個問題.直到我偶然發現 此評論 上的一個電子對我有用問題線程.

I feel your pain. I have this issue on one of my boxes (a Server2012 box). Nothing worked for me until I stumbled across this comment on one of the electron issues threads.

通常,當您安裝 electron 時,您的 package.json 中會有一個如下所示的腳本.

Typically when you install electron you will have a script in your package.json that looks like this.

"scripts": {
    "start": "electron .",
}

我改成了

"scripts": {
    "start": "C:/path/to/project/node_modules/electron-prebuilt/dist/electron.exe .",
}

我開始從 powershell 中的主電子進程獲取日志記錄.

And I started to get logging from the main electron process in powershell.

請注意,如果您使用較新版本的電子,您可能需要將 electron-prebuilt 更改為 electron.

Note that if you are using newer versions of electron, you may need to change electron-prebuilt to electron.

這篇關于將 console.log() 與電子一起使用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進程中創建子窗口時如何修復 BrowserWindow 不是構造函數錯誤) - IT屋-程序員軟件開發技術
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無法在第二個 loadURL 上執行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲?)
How to access camera/webcamera inside electron app?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 亚洲高清免费观看 | 国外成人在线视频网站 | 日韩视频中文字幕 | 中文字幕日韩专区 | aa级毛片毛片免费观看久 | 涩涩导航 | 一区二区三区精品在线视频 | 欧美视频福利 | 激情三区 | 精品久久99 | 欧美不卡在线 | 久久国产精品一区二区三区 | 在线免费毛片 | 亚洲欧美日韩精品久久亚洲区 | 精品久久国产 | 欧美一区2区三区4区公司二百 | 国产精品久久久久999 | 亚洲日韩中文字幕一区 | 国产精品高潮呻吟久久 | 午夜影院免费体验区 | 亚欧洲精品在线视频免费观看 | 玖玖免费| 成人日韩精品 | 国产精品一区网站 | 全免费a级毛片免费看视频免 | 国产 日韩 欧美 在线 | 91影院在线观看 | 狠狠入ady亚洲精品经典电影 | 国产色爽 | 免费av直接看 | 国产精品久久国产精品 | 久久视频免费看 | 国产激情在线看 | 97超碰成人 | 日韩高清中文字幕 | 国产一区二区在线91 | 日本在线播放一区二区 | 美女一级a毛片免费观看97 | 中文精品视频 | 亚洲一区二区在线免费观看 | 国产精品久久久久久一区二区三区 |