2017-10-16 146 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

事實證明,問題與權限運行服務器的帳戶有關。該帳戶無權寫入正試圖寫入的目錄。