Electron中 提示:Uncaught ReferenceError: process is not defined
生活随笔
收集整理的這篇文章主要介紹了
Electron中 提示:Uncaught ReferenceError: process is not defined
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
場景
用HTML和CSS和JS構(gòu)建跨平臺(tái)桌面應(yīng)用程序的開源庫Electron的介紹以及搭建HelloWorld:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/106413828
在上面搭建起來Electron的HelloWorld程序后。
想要在js中使用process對象時(shí)提示:
Uncaught ReferenceError: process is not defined
?
注:
博客:
https://blog.csdn.net/badao_liumang_qizhi
關(guān)注公眾號(hào)
霸道的程序猿
獲取編程相關(guān)電子書、教程推送與免費(fèi)下載。
實(shí)現(xiàn)
本來是想在js中通過process獲取一些信息的
var btn=document.getElementById('buttonProcess');btn.onclick=getProcessInfo;function getProcessInfo() {console.log("getProcessInfo**********************");console.log("getCPUUsage:",process.getCPUUsage);//cpu操作位數(shù)console.log("arch:",process.arch);//環(huán)境變量console.log("env:",process.env); }如果想使用process對象要在main.js中添加如下代碼
nodeIntegration:true添加位置如下
?
然后重啟項(xiàng)目!重啟項(xiàng)目!重啟項(xiàng)目!
總結(jié)
以上是生活随笔為你收集整理的Electron中 提示:Uncaught ReferenceError: process is not defined的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Electron中提示:Refused
- 下一篇: Electron中通过process进程