久久久久久久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?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 国产黄色片在线观看 | 亚洲精品国产精品国自产在线 | 免费久久| 麻豆影音| 国内精品国产成人国产三级 | 91激情视频| 亚洲免费黄色 | 欧美一级大片 | 国产麻豆一区二区 | 九九九色 | 国产在线高清 | 日韩不卡免费视频 | 欧美在线播放视频 | 中文字幕日韩视频 | 最新国产精品 | 99热国产 | 亚洲精品福利视频 | 久久久久久成人 | 欧美激情网址 | 亚洲特级片| 怡红院久久 | 免费看黄色录像 | 欧美精品久久久久久久 | 黄色精品视频 | 亚洲91精品 | 国产精品一区在线 | 免费在线观看黄色网址 | 久久er99热精品一区二区 | 噜噜噜在线 | 久久精品在线 | 日本中文字幕在线观看 | 午夜国产在线观看 | 日韩在线精品视频 | 日日干日日 | 久久艹国产 | 久久综合国产 | 国产三级黄色片 | 精品自拍视频 | 在线观看日韩视频 | 国产精品理论片 | 4虎最新网址 |