gpt4 book ai didi

javascript - 为什么此 GET 请求找不到我的脚本?

转载 作者:行者123 更新时间:2023-11-27 22:52:29 25 4
gpt4 key购买 nike

我在尝试使用 npm 和 grunt 设置页面时遇到错误。

Request URL:http://localhost:9997/bower_components/requirejs/require.js
Request Method:GET
Status Code:404 Not Found

遇到问题的 html 看起来像这样:

<script>
var require = {
baseUrl: '/',
paths: {
'underscore': '/bower_components/underscore/underscore',
'backbone': '/bower_components/backbone/backbone',
'jquery': '/bower_components/jquery/dist/jquery',
'react': '/bower_components/react/react',
'mustache': '/bower_components/mustache/mustache',
'mySite-assets': '.'
}
};
</script>

//Specifically this next line:
<script src="/bower_components/requirejs/require.js"></script>

我在 html 文件中所做的任何更改都会在运行 grunt 后立即恢复。我的所有 html 文件都存在这个问题。我有一个相当大的项目,我无法真正弄清楚要更改哪个配置文件来解决这个问题。

最佳答案

感谢您的帮助@topheman!

我一直在寻找错误的地方。 grunt 脚本中/bower_components 的路径不正确。设置正确的路径后,我的所有 html 脚本现在都不再出现此错误。

只是用错误的路径更改了这一行:

cwd: 'public/components',

使用正确的路径进入这一行:

cwd: 'bower_components',

关于javascript - 为什么此 GET 请求找不到我的脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37953996/

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