简体   繁体   English

Node.js错误:使用simple-git克隆仓库时生成git ENOENT

[英]Nodejs Error: spawn git ENOENT when using simple-git to clone repo

I am building an app that clones a repo, parses xml files in the repo and displays the information. 我正在构建一个可克隆存储库,解析该存储库中的xml文件并显示信息的应用程序。 I am using the simple-git npm module. 我正在使用simple-git npm模块。 I have this working on my local system, and on the dev test server. 我可以在本地系统和开发测试服务器上使用它。 I am trying to deploy it to an integration server and this is the error I get. 我正在尝试将其部署到集成服务器,这是我得到的错误。 Some of the stuff I have seen says it is because the directory I'm attempting to clone to doesn't exist, but it most definitely does. 我看到的一些内容是因为我要克隆到的目录不存在,但绝对可以。

从控制台输出中截取

Here is the code I wrote to either clone the repo if it doesn't exists or pull pull the latest changes. 这是我编写的用于克隆存储库(如果不存在)或拉出最新更改的代码。 This is a method of a class. 这是一个类的方法。 this.path is the path to the directory the repo will be cloned to. this.path是存储库将被克隆到的目录的路径。 this.repoRoot is the path to the root of the repo on the local system. this.repoRoot是本地系统上存储库根目录的路径。 this.remote is the url for the remote. this.remote是遥控器的URL。

  /** * gets the latest version of the remote repo and specified branch by either using clone or pull * @return {Promise<void>} */ getLatest() { return new Promise((resolve, reject) => { this.checkForDir(this.path).then((parentDirExists) => { if (!parentDirExists) { fs.mkdirSync(this.path); } }).then(() => { this.checkForDir(this.repoRoot).then((repoExistsLocally) => { if (!repoExistsLocally) { git(this.path).clone(this.remote).then((cloneResult) => { git(this.repoRoot).checkout(this.branch).then(() => { resolve(); }); }); } else { git(this.repoRoot).pull().then((pullResult) => { resolve(); }); } }) }) }) } 

Thanks in advance for any help! 在此先感谢您的帮助!

As it turns out, the problem was related to permissions the account the server was running on. 事实证明,问题与服务器在其上运行的帐户的权限有关。 The account did not have permissions to write to the directory it was attempting to write to. 该帐户无权写入其尝试写入的目录。

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

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