繁体   English   中英

Nodegit和Electron无法一起工作

[英]Nodegit and Electron not working together

我在使用nodegit时遇到此错误,并且我不确定是由于我不知道如何使用电子遥控器进行操作是我的错,还是因为nodegit出现了问题。 我确实提出了一个问题 ,以防万一。

在我的电子main.js文件中,我可以毫无问题地使用nodegit。

在网站上,我尝试将nodegit与remote一起使用。 我得到一个错误。 我的代码:

var remote = require('electron').remote;
var pathToRepo = remote.require('path').resolve(currentRepoDir);
remote.require('nodegit').Repository.open(pathToRepo).then(function(repo){
  console.log(repo);
}); 

我收到错误消息:

Uncaught TypeError: require(...).remote.require(...).Repository.open is not a function

为什么open不起作用?

为什么要使用remote.require

remote.require('path')

只需使用:

require('path')

在渲染过程中也require工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM