簡體   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