官方发布了,禁止使用所有nodejs API了。From Electron 20 onwards, preload scripts are sandboxed by default and no longer have access to a full Node.js environment. Practically, this means that you have a polyfilled require function that only has access to a limited set of APIs. 有用 回复 三_...
问题发生在我安装了electron之后,为了创建一个桌面版本的查看器,即使在电子应用程序中,所有的东西都仍然正常工作,但是我使用const { ipcRenderer } =require('electron在我尝试用gulp generic构建应用程序之前,它也很好,它通过了一个错误,上面写着Module not found: Error: Can't resolve 'fs' in '/ ...
1:node:electron/js2c/sandbox_bundle:93 Unable to load preload script: I:\electron\preload.js 2:node:electron/js2c/sandbox_bundle:93 Error: module not found: path首页可以排除node安装或环境的问题,这块肯定没问题。 electron 有用关注2收藏1 回复 阅读8k 1 个回答 得票最新 Meathill 22.4k133642 ...
require: (module: 'electron') => { ipcRenderer: IpcRenderer } } } 在页面中使用 const { ipcRenderer } = window.require('electron') ipcRenderer.send('...') 一大批坑还在等待...
- http://, https://, or file:// URL. Options: -i, --interactive Open a REPL to the main process. -r, --require Module to preload (option can be repeated). -v, --version Print the version. -a, --abi Print the Node ABI version. image-20200428003619091...
Electron 应用中 js 调用 C++ 扩展时,提示 Error: The specified module could not be found。 答:该错误表示能找到 C++ 扩展模块(.node)但是加载失败,因为 .node 会依赖其他 .dll 和 C++ 运行库,缺少这些库时就会报上面的错误,使用 depends 查看缺少哪种库,配置即可。
preload的工作是在创建窗体时预加载需要node模块到渲染进程,然后以API方式暴露给渲染进程调用,preload共享渲染进程的window、document对象,因此preload可以轻松操作DOM,而渲染进程不共享preload的global对象。 preload.js const { contextBridge, ipcRenderer} = require('electron'); ...
const path = require('path'); const merge = require('webpack-merge').merge; module.exports = env => { const config = { devtool: 'inline-source-map', mode: 'development', optimization: { emitOnErrors: true, minimize: false }, context: __dirname, output: { filename: '[name].js...
module.exports = new WinA(); // 打开窗口A const { winA } = require('./windowCenter'); winA.open(); ``` ## 服务进程类 ### 说明 Suger-Electron框架提供服务进程类,开发者只需要传入启动入口文件,即可创建一个服务进程。 所谓的服务进程,即承载了原来主进程应该执行的代码的渲染进程。上面有介绍到...
The specified module could not be found. AppData\Local\Temp\xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.tmp.node stackoverflow.com/questions/4…有提到大致的原生就是 .node缺少一些dll库。可以使用www.dependencywalker.com/检查缺少啥 我做了四种尝试: