【问题标题】:Can't restore Bower packages in ASP.NET core application?无法在 ASP.NET 核心应用程序中恢复 Bower 包?
【发布时间】:2018-12-24 12:55:20
【问题描述】:

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

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

PATH=.\node_modules.bin;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Web\External;%PATH%;C:\Program Files (x86)\微软视觉 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" 安装引导程序#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"
  }
}

有什么帮助吗?

【问题讨论】:

  • 如果您打开消息中的链接(即bower.herokuapp.com/packages/bootstrap),您将看到:This Bower version is deprecated. Please update it: npm install -g bower. The new registry address is https://registry.bower.io 和 chrome 工具将显示状态代码 os 502(网关错误)。我想更新凉亭再试一次?

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


【解决方案1】:
  1. 打开位于项目根文件夹中的 .bowerrc 文件。
  2. 将registry 属性添加到文件的内容中,指向新的凉亭注册表。它应该是这样的:

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

阅读:Workaround for Bower Version Deprecation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-15
    • 2016-07-28
    • 1970-01-01
    • 1970-01-01
    • 2017-05-29
    • 2017-05-25
    • 1970-01-01
    相关资源
    最近更新 更多