来自Appveyor的GitHub API未经授权的响应

时间:2016-01-29 11:34:36

标签: github jspm appveyor

我们刚刚开始了一个新项目,并尝试通过Appveyor使CI工作。 它是一个Aurelia Web应用程序,因此我们需要在构建服务器上使用jspm

在我的工作站上我{@ 3}} @guybedford在下面的回答中建议并在appveyor.yml脚本中配置我的authtoken:

  - jspm config registries.github.auth %JSPM_GITHUB_AUTH_TOKEN%

目前,我的appveyor.yml基于configured jspm manually

看起来像这样
version: 1.0.{build}
os: Visual Studio 2015
build:
  verbosity: detailed
environment:
  JSPM_GITHUB_AUTH_TOKEN:#token from jspm registry export github (locally)#
install:
  - ps: Set-Culture nl-NL
  - ps: Install-Product node $env:nodejs_version
  - cd src\Web
  - npm uninstall jspm -g
  - npm install -g jspm
  - npm install -g gulp
  - npm install
  - jspm config registries.github.auth %JSPM_GITHUB_AUTH_TOKEN%
  - jspm config registries.github.maxRepoSize 0
  - jspm registry export github #output to see what the registry looks like
  - jspm install -y
  - gulp build
  - cd ..\..
nuget:
  account_feed: true
before_build:
  - dnvm install -r clr -arch x86 1.0.0-rc1-update1
  - dnu restore
  - nuget restore

jspm install - y命令失败,错误为:Unauthorized response for GitHub API

如何在AppVeyor上使用JSPM正确配置Github凭据?

2 个答案:

答案 0 :(得分:2)

最好在本地配置凭据后从jspm registry export github获取此令牌,以便使用与jspm完全相同的算法,而不是进行手动编码。

如果您真的想要手动编码,则身份验证令牌实际上取值为new Buffer(encodeURIComponent(username) + ':' + encodeURIComponent(password)).toString('base64')

答案 1 :(得分:1)

在与Appveyor团队联系后,我们发现节点版本是问题所在。 安装稳定版本的Node就像魅力一样:

ps: Install-Product node stable