gpt4 book ai didi

javascript -/bower_components 不加载页面上的依赖项

转载 作者:搜寻专家 更新时间:2023-10-31 22:48:20 24 4
gpt4 key购买 nike

/bower_components 不起作用。

我收到 404 错误:

GET /bower_components/jquery/jquery.js 404

我的配置如 Bower 文档和 here 中所述:

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

在我的 .html 文件中我有:

<script src="/bower_components/jquery/jquery.js"></script>

但是没有/bower_components/jquery/jquery.js。有 \bower_components\jquery\dist\jquery.js。他们是否更改了 Bower 包的配置但忘记更改文档?

最佳答案

您应该更改您的脚本标记以指向 jQuery 的(新)位置:

<script src="/bower_components/jquery/dist/jquery.js"></script>

看起来 jQuery 通过在其 bower 组件中提供两个目录,将“源”代码与“分发”代码分开。不建议您在 bower_components 中移动内容,因为该目录是从 bower 安装生成的。

关于javascript -/bower_components 不加载页面上的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23933621/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com