asp dotnet core on linux: missing all bower packages

五迷三道 提交于 2019-12-13 06:28:24

问题


For simplicity I am focusing one just one bower-installed library, but it doesn't load any bower-installed package under /lib

Project works fine under Windows, but it doesn't find bower-installed backages under Linux.

Chrome shows this error:

GET http://localhost:5000/lib/pikaday/pikaday.js 

404 not found

In the view:

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

I have my bower.json in the solution:

{
  "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.js is part of the handsontable package)

How can I make dotnet run / dotnet build / dotnet publish on linux include those bower packages?


回答1:


As user Baklap4 mentioned in the comments, it needs to run bower install so it retrieves the dependencies via npm (it's not done automatically as in Visual Studio).

Of course you need Bower installed first (otherwise on dotnet publish you will get the error "'bower' is not recognized as an internal or external command"):

npm install -g bower

Running that in Ubuntu, I encountered this other problem:

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

The solution can be found here, which is adding a logical link in linux:

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

Finally, repeat:

bower install


来源:https://stackoverflow.com/questions/41676966/asp-dotnet-core-on-linux-missing-all-bower-packages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!