无法在 ASP.NET 核心应用程序中恢复 Bower 包?

Can't restore Bower packages in ASP.NET core application?

我下载了 this sample app,缺少 bower 包:

当我恢复它们时,这会显示在输出中 window:

PATH=.\node_modules.bin;C:\Program Files (x86)\Microsoft Visual Studio17\Community\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio17\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;C:\Program Files (x86)\Microsoft Visual Studio17\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin "C:\Program Files (x86)\Microsoft Visual Studio17\Community\Web\External\Bower.cmd" install bootstrap#3.3.7 --force-latest bower bootstrap#3.3.7 EINVRES Request to https://bower.herokuapp.com/packages/bootstrap failed with 502

.NET 核心版本在我的机器上:2.1.302

Visual Studio 版本:15.7.4

bower.json:

{
  "name": "asp.net",
  "private": true,
  "dependencies": {
    "bootstrap": "3.3.7",
    "jquery": "2.2.0",
    "jquery-validation": "1.14.0",
    "jquery-validation-unobtrusive": "3.2.6"
  }
}

有什么帮助吗?

  1. 打开位于项目根文件夹中的 .bowerrc 文件。
  2. registry 属性 添加到文件内容,指向新的 Bower 注册表。它应该是这样的:

    {
      "registry": "https://registry.bower.io",
      "directory": "wwwroot/lib"
    }
    

读这个:Workaround for Bower Version Deprecation