renderer.js中不能使用node API是跟node.js的版本有关系吗?
来源:2-2 创建 browserWindow
ibuole
2022-05-03
// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// No Node.js APIs are available in this process because
// `nodeIntegration` is turned off. Use `preload.js` to
// selectively enable features needed in the rendering
// process.
写回答
4回答
-
慕后端24501
2022-05-12
主窗口增加
webPreferences:{nodeIntegration:true,
contextIsolation: false
} 可以调起来
31 -
莫子轩
2022-06-29
补充回答,去官网看了下,老师的是mac系统,因为路径问题导致报错,改为官方写法后就可以了
<script src="./renderer.js"></script>
运行结果
20 -
莫子轩
2022-06-29
可以了
00 -
慕后端24501
2022-05-12
同问 我发现我这边也不能调用node api
00
相似问题
