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

Electron“未捕獲的引用錯誤:未定義要求"

Electron quot;Uncaught ReferenceError: require is not definedquot;(Electron“未捕獲的引用錯誤:未定義要求)
本文介紹了Electron“未捕獲的引用錯誤:未定義要求"的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試使用此腳本執行文件:

I'm trying to execute a file with this script:

 <script>
      function verify() {
    var child = require('child_process').execFile;
  var executablePath = "C:\file";
  
  child(executablePath, function(err, data) {
  if(err){
     console.error(err);
     return;
  }
  
  console.log(data.toString());
    });
  }
    </script>

但是當我運行這個腳本時,我得到了錯誤Uncaught ReferenceError: require is not defined".我試圖解決這個問題 3 天沒有成功.我已經啟用了節點集成,安裝了 browserify 并閱讀了 10 個不同的解釋,說明如何做到這一點,但沒有成功.有人知道解決此問題或執行文件的替代方法嗎?

But when I run this script I get error "Uncaught ReferenceError: require is not defined". I've tried to fix this for 3 days with no sucess. I've enabled node intergration, installed browserify and read 10 diferrent explainations on how to do it with no success. Do anybody know a fix for this or a alternative on executing a file?

推薦答案

參見 Electron 文檔.

您只能在 ma??in 進程中使用 require(并使用 child_process 模塊),但您正試圖從渲染器進程.

You can only use require (and use the child_process module) from the main process, but you are trying to use it from the renderer process.

將其移至主進程.

如果您需要從渲染器進程觸發該功能(例如,當用戶單擊按鈕時),請使用 ipcRenderer 模塊 向主進程發送消息(并在那里有一個監聽器,它將調用 verify 函數來響應該消息).

If you need to trigger the function from the renderer process (e.g. when the user clicks on a button) then use the ipcRenderer module to send a message to the main process (and have a listener there which will call the verify function in response to that message).

這篇關于Electron“未捕獲的引用錯誤:未定義要求"的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 亚洲福利在线观看 | 国产精品美女www爽爽爽 | 国产成人精品久久久 | 欧美日韩在线一区二区 | 成人精品在线观看 | 欧美一级黄色片在线观看 | 久久不射电影网 | 亚洲欧美日韩精品久久亚洲区 | 精品亚洲一区二区三区四区五区 | 亚洲小视频 | 亚洲国产aⅴ精品 | 中文字幕国产日韩 | 中文字幕日韩欧美一区二区三区 | 激情久久av一区av二区av三区 | 国产成人精品久久 | 久久高潮 | 久久久久香蕉视频 | 成人一区二区三区 | 亚洲免费成人 | 成人精品视频免费 | 国产精品美女久久久久aⅴ国产馆 | 亚洲国产成人精品久久久国产成人一区 | 日日碰狠狠躁久久躁婷婷 | 一区二区三区四区在线 | 色综合av | 欧美日韩一区精品 | 亚洲免费在线观看 | 97精品国产97久久久久久免费 | 另类一区 | 北条麻妃99精品青青久久主播 | 亚洲免费毛片 | 国产剧情久久 | 免费黄色a视频 | 一区二区在线免费观看视频 | 妹子干综合 | 久久在线免费 | aaa精品 | 福利视频一二区 | 91精品欧美久久久久久久 | 成人毛片视频免费 | 国产精品久久久久久久久久久久久久 |