/dist/handsontable.full.js 404 找不到凉亭

/dist/handsontable.full.js 404 Not Found with bower

我已经使用 bower 安装了 Handsontable,如 its documentation 所示:

bower install handsontable --save

并且我将这些链接添加到 view.ejs

<script src="/dist/handsontable.full.js"></script>
<link rel="stylesheet" media="screen" href="/dist/handsontable.full.css">

但我在浏览器中收到以下 404 错误

"NetworkError: 404 Not Found - http://localhost:3000/dist/handsontable.full.js"
handson...full.js

"NetworkError: 404 Not Found - http://localhost:3000/dist/handsontable.full.css"
handson...ull.css
ReferenceError: Handsontable is not defined in  

var hot = new Handsontable(container, {

即使我尝试将链接更改为绝对文件位置(项目的根目录作为参考):

<script src="./bower_components/handsontable/dist/handsontable.full.js"></script>
<link rel="stylesheet" media="screen" href="./bower_components/handsontable/dist/handsontable.full.css">

我仍然有同样的问题:

"NetworkError: 404 Not Found - http://localhost:3000/bower_components/handsontable/dist/handsontable.full.js"
handson...full.js
2
"NetworkError: 404 Not Found - http://localhost:3000/bower_components/handsontable/dist/handsontable.full.css"
handson...ull.css
ReferenceError: Handsontable is not defined


var hot = new Handsontable(container, {

--- 编辑 ----

这是我的项目结构,我在加载时也遇到了同样的问题jquery.js

我尝试了 this question 的所有解决方案,但其中 none 有效。

这对我有用:

app.use("/bower_components", express.static(path.join(__dirname, 'bower_components'))); 

我的错误是这样写的:

app.use("bower_components", express.static(__dirname + '/bower_components')); // this is wrong

并且在视图中,我写的内容并不重要

(./bower_components or ../bower_components).

所有这些对我有用:

<script src="../bower_components/handsontable/dist/handsontable.full.js"></script>
<link rel="stylesheet" media="screen" href="bower_components/handsontable/dist/handsontable.full.css">