无法在ASP.NET核心应用程序中还原Bower软件包?

时间:2018-07-16 22:34:10

标签: asp.net-core .net-core bower asp.net-core-2.1

我下载了this sample app,缺少的凉亭包:

enter image description here

还原它们时,它会显示在输出窗口中:

  

PATH =。\ node_modules.bin; C:\ Program Files(x86)\ Microsoft Visual   Studio \ 2017 \ Community \ Web \ External;%PATH%; C:\ Program文件   (x86)\ Microsoft Visual   Studio \ 2017 \ Community \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TeamFoundation \ Team   Explorer \ Git \ cmd; C:\ Program Files(x86)\ Microsoft Visual   Studio \ 2017 \ Community \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TeamFoundation \ Team   Explorer \ Git \ mingw32 \ bin“ C:\ Program Files(x86)\ Microsoft Visual   Studio \ 2017 \ Community \ Web \ External \ Bower.cmd”,安装bootstrap#3.3.7   --force-latest bower bootstrap#3.3.7 EINVRES对https://bower.herokuapp.com/packages/bootstrap的请求失败,并显示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 个答案:

答案 0 :(得分:1)

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

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

阅读:Workaround for Bower Version Deprecation