2017-10-16 147 views
0

我正在构建一个克隆repo,分析repo中的xml文件并显示信息的应用程序。我正在使用simple-git npm模块。我在本地系统和开发测试服务器上工作。我试图将它部署到集成服务器,这是我得到的错误。我见过的一些东西说这是因为我试图克隆的目录不存在,但它绝对是。Nodejs错误:当使用simple-git克隆repo时产生git ENOENT

snip from console output

这里是我写的任何克隆回购,如果它不存在,它还是拽拽的最新变化的代码。这是一个班的方法。 this.path是repo将被克隆到的目录的路径。 this.repoRoot是本地系统上回购的根的路径。 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(); 
 
      }); 
 
      } 
 
     }) 
 
     }) 
 
    }) 
 
    }

在此先感谢您的帮助!

回答

0

事实证明,问题与权限运行服务器的帐户有关。该帐户无权写入正试图写入的目录。