TeamCity 在 WindowsServer 上无法 运行 "npm install"
TeamCity fails to run "npm install" on WindowsServer
我在 TeamCity 中有一个构建步骤正在执行
npm install
这是一个 Node.js 项目。
失败并出现以下错误:
[10:49:37]npm ERR! git clone
--template=C:\npm-cache_git-remotes_templates --mirror git://github.com/ifandelse/riveter.git
C:\npm-cache_git-remotes\git-github-com-ifandelse-riveter-git-0cffebb92117c88543cb4359fb9fd69c2d65dd22-e68db054c0bd30b07ce1f9879b4f866f:
Cloning into bare repository
'C:\npm-cache_git-remotes\git-github-com-ifandelse-riveter-git-0cffebb92117c88543cb4359fb9fd69c2d65dd22-e68db054c0bd30b07ce1f9879b4f866f'...
[10:49:37]npm ERR! git clone
--template=C:\npm-cache_git-remotes_templates --mirror git://github.com/ifandelse/riveter.git
C:\npm-cache_git-remotes\git-github-com-ifandelse-riveter-git-0cffebb92117c88543cb4359fb9fd69c2d65dd22-e68db054c0bd30b07ce1f9879b4f866f:
fatal: unable to connect to github.com: [10:49:37]npm ERR! git clone
--template=C:\npm-cache_git-remotes_templates --mirror git://github.com/ifandelse/riveter.git
C:\npm-cache_git-remotes\git-github-com-ifandelse-riveter-git-0cffebb92117c88543cb4359fb9fd69c2d65dd22-e68db054c0bd30b07ce1f9879b4f866f:
github.com[0: 192.30.252.129]: errno=No error [10:50:09]npm ERR!
Windows_NT 6.1.7601 [10:50:09]npm ERR! argv "C:\Program
Files\nodejs\node.exe" "C:\Program
Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
"--msvs_version=2012" [10:50:09]npm ERR! node v0.10.33 [10:50:09]npm
ERR! npm v3.3.10 [10:50:09]npm ERR! code 128 [10:50:09] [10:50:09]npm
ERR! Command failed: Cloning into bare repository
'C:\npm-cache_git-remotes\git-github-com-ifandelse-riveter-git-0cffebb92117c88543cb4359fb9fd69c2d65dd22-e68db054c0bd30b07ce1f9879b4f866f'...
[10:50:09]npm ERR! fatal: unable to connect to github.com:
[10:50:09]npm ERR! github.com[0: 192.30.252.129]: errno=No error
[10:50:09]npm ERR! [10:50:09]npm ERR! [10:50:09]npm ERR!
[10:50:09]npm ERR! If you need help, you may report this error at:
[10:50:09]npm ERR! https://github.com/npm/npm/issues;
我可以从命令行 运行 npm install 正常。这需要"run as Administrator"思考。
我已尝试为 TeamCityAgent 用户添加管理员角色。
我很确定权限有问题。
可能是因为您无法通过 ssh 或 git 协议连接到 github(可能是因为防火墙或其他原因)。
尝试强制 git 通过 https 克隆:
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
我在 TeamCity 中有一个构建步骤正在执行
npm install
这是一个 Node.js 项目。
失败并出现以下错误:
[10:49:37]npm ERR! git clone --template=C:\npm-cache_git-remotes_templates --mirror git://github.com/ifandelse/riveter.git C:\npm-cache_git-remotes\git-github-com-ifandelse-riveter-git-0cffebb92117c88543cb4359fb9fd69c2d65dd22-e68db054c0bd30b07ce1f9879b4f866f: Cloning into bare repository 'C:\npm-cache_git-remotes\git-github-com-ifandelse-riveter-git-0cffebb92117c88543cb4359fb9fd69c2d65dd22-e68db054c0bd30b07ce1f9879b4f866f'... [10:49:37]npm ERR! git clone --template=C:\npm-cache_git-remotes_templates --mirror git://github.com/ifandelse/riveter.git C:\npm-cache_git-remotes\git-github-com-ifandelse-riveter-git-0cffebb92117c88543cb4359fb9fd69c2d65dd22-e68db054c0bd30b07ce1f9879b4f866f: fatal: unable to connect to github.com: [10:49:37]npm ERR! git clone --template=C:\npm-cache_git-remotes_templates --mirror git://github.com/ifandelse/riveter.git C:\npm-cache_git-remotes\git-github-com-ifandelse-riveter-git-0cffebb92117c88543cb4359fb9fd69c2d65dd22-e68db054c0bd30b07ce1f9879b4f866f: github.com[0: 192.30.252.129]: errno=No error [10:50:09]npm ERR! Windows_NT 6.1.7601 [10:50:09]npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "--msvs_version=2012" [10:50:09]npm ERR! node v0.10.33 [10:50:09]npm ERR! npm v3.3.10 [10:50:09]npm ERR! code 128 [10:50:09] [10:50:09]npm ERR! Command failed: Cloning into bare repository 'C:\npm-cache_git-remotes\git-github-com-ifandelse-riveter-git-0cffebb92117c88543cb4359fb9fd69c2d65dd22-e68db054c0bd30b07ce1f9879b4f866f'... [10:50:09]npm ERR! fatal: unable to connect to github.com: [10:50:09]npm ERR! github.com[0: 192.30.252.129]: errno=No error [10:50:09]npm ERR! [10:50:09]npm ERR! [10:50:09]npm ERR! [10:50:09]npm ERR! If you need help, you may report this error at: [10:50:09]npm ERR! https://github.com/npm/npm/issues;
我可以从命令行 运行 npm install 正常。这需要"run as Administrator"思考。
我已尝试为 TeamCityAgent 用户添加管理员角色。
我很确定权限有问题。
可能是因为您无法通过 ssh 或 git 协议连接到 github(可能是因为防火墙或其他原因)。 尝试强制 git 通过 https 克隆:
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://