Linux 上的 ASP dotnet core:缺少所有 bower 包



为简单起见,我只关注一个 bower 安装的库,但它不会在/lib 下加载任何 bower 安装的软件包

项目在Windows下运行良好,但在Linux下找不到bower安装的后台。

Chrome 会显示此错误:

GET http://localhost:5000/lib/pikaday/pikaday.js 
404 not found

在视图中:

<script src="/lib/pikaday/pikaday.js"></script>

我在解决方案中有自己的bower.json

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

pickaday.jshandsontable包的一部分)

如何在 linux 上dotnet run/dotnet build/dotnet publish包含这些 bower 软件包?

正如用户Baklap4在评论中提到的,它需要运行bower install,以便通过npm检索依赖项(它不像Visual Studio那样自动完成)。

当然,您需要先安装 Bower(否则dotnet publish会收到错误"'bower'未被识别为内部或外部命令"):

npm install -g bower

在 Ubuntu 中运行它,我遇到了另一个问题:

bower install
/usr/bin/env: node: No such file or directory

解决方案可以在这里找到,即在linux中添加一个逻辑链接:

ln -s /usr/bin/nodejs /usr/bin/node

最后,重复:

bower install

最新更新