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