2015-04-05 41 views
3

我試圖將我的項目部署到天藍。這是失敗的。這些是我採取的步驟。節點項目失敗的Azure git部署

git init 
git config core.longpaths true 
git add . 
git commit -m "initial commit" 

所有的工作。我將git配置爲接受長路徑,因爲我需要chokidar,並且chokidar有一些深層嵌套的依賴關係,最大限度地超出了git的字符限制。然後,我轉到azure,創建一個新的Web應用程序,選擇自定義,從本地git存儲庫進行部署,將遠程倉庫添加到本地git。一切正常。但是,當我運行git push azure master,我得到這個錯誤:

remote: Updating branch 'master'. 
remote: Deployment failed 
remote: Error - Changes committed to remote repository but deployment to website failed. 

所以我去了一個空目錄,使長的路徑,並克隆回購。它給了我這個錯誤:

remote: warning: unable to access 'node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/regex-cache/node_modules/benchmarked/node_modules/file-reader/node_modules/map-files/node_modules/globby/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/.gitattributes': Filename too long 
remote: Counting objects: 5183, done. 
remote: Compressing objects: 100% (3893/3893), done. 
remote: Total 5183 (delta 489), reused 5183 (delta 489) 
Receiving objects: 100% (5183/5183), 4.05 MiB | 1.51 MiB/s, done. 
Resolving deltas: 100% (489/489), done. 
Checking connectivity... done. 
fatal: cannot create directory at 'node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/regex-cache/node_modules/benchmarked/node_modules/file-reader/node_modules/map-files/node_modules/globby/node_modules/array-union/node_modules/array-uniq': Filename too long 
warning: Clone succeeded, but checkout failed. 
You can inspect what was checked out with 'git status' and retry the checkout with 'git checkout -f HEAD' 

有像上面的第一個更多的錯誤。所以我認爲Git Azure在其服務器上運行時未配置爲接受長文件路徑?我可以從版本控制中刪除node_modules並配置azure下載它們嗎?

回答

1

你是正確的

  1. 添加/ node_modules到的.gitignore。
  2. 爲您的packages.json添加依賴關係,並讓Azure在部署時安裝它們(每個新/更新程序包只能一次性安裝)。

PS:由於您已將/ node_modules文件夾推送到版本控制,因此您必須先將其刪除。

+0

謝謝,這工作。但是沒有辦法使用git將長文件名的文件推送到Azure中? – 2015-04-05 21:08:13

+0

可能與git無關。這是使用windows api時ntfs文件系統的限制。 https://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath – 2015-04-05 23:05:02