加载资源404(未找到)失败-文件位置错误
Failed to load resource 404 (Not Found) - file location error?
我正在构建一个Angular 2应用程序,我刚刚升级到Net Core RC2。在升级之前,我的网页会显示得很好,但现在我在我的Chrome开发工具控制台得到错误:
Failed to load resource: the server responded with a status of 404 (Not Found):
http://localhost:5000/lib/bootstrap/dist/js/bootstrap.min.js
Failed to load resource: the server responded with a status of 404 (Not Found):
http://localhost:5000/lib/bootstrap/dist/css/bootstrap/bootstrap.min.css
我有bootstrap在我的包。3.3.6版本的Json文件。我用npm install命令安装它。它正确地安装在我的Visual Studio项目中。这些文件位于:
project -> node_modules -> bootstrap -> dist -> js -> bootstrap .min.js
和
project -> node_modules -> bootstrap -> dist -> css -> boostrap.min.css
我的gulpfile有这样一段:
var config = {
libBase: 'node_modules',
lib: [
require.resolve('bootstrap/dist/css/bootstrap.min.css'),
require.resolve('bootstrap/dist/js/bootstrap.min.js'),
path.dirname(require.resolve('bootstrap/dist/fonts/glyphicons-halflings-regular.woff')) + '/**',
require.resolve('jquery/dist/jquery.min.js'),
require.resolve('chart.js/dist/Chart.bundle.min.js')
]
};
我还看到一个_Layout中对bootstrap.min.js的引用。cshtml文件:
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Homepage WebDev</title>
<base href="/" />
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
</head>
<body>
@RenderBody()
@RenderSection("scripts", required: false)
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="~/lib/chart.js/dist/Chart.bundle.min.js"></script>
</body>
</html>
我是网络开发的新手,所以我不完全确定发生了什么。有人能给我指个正确的方向吗?
看起来您给出的路径中没有任何引导文件。
href="~/lib/bootstrap/dist/css/bootstrap.min.css"
确保文件在那里存在,否则将文件指向正确的路径,在您的情况下应该是
href="~/node_modules/bootstrap/dist/css/bootstrap.min.css"
相关文章:
- $codovaFileTransfer下载非JPEG文件失败
- 在 Firefox 中加载带有 require.js 的文本文件失败:“AccessControlException”
- 在jspdf中使用addHTML保存pdf文件失败
- 当分离到不同的文件中时,测试失败
- 导入模块失败's css文件
- 创建具有多个子文件夹链接的Ajax网站失败
- 如何知道向iframe提交表单和文件是否失败
- 本地文件上的Windows Phone 8 jQuery.ajax失败
- JavaScript到.csv的下载失败:;失败.无文件”;
- 在Chrome扩展中使用PAC文件重定向HTTPS请求似乎失败了
- 如何允许Dropzone.js失败后重新提交文件上传
- 在引导程序中运行自定义jquery文件,但失败
- jQuery文件下载插件总是在失败功能
- JQuery 验证输入类型文件在服务器端失败
- 将 JavaScript 文件与 Prepros 连接失败
- 加载远程 JavaScript 文件失败是否会停止在任何浏览器中执行 JavaScript
- 如果输入文件丢失,有没有办法导致 Grunt 插件失败
- Corodva 文件读取执行成功和失败回调
- 在页面加载/单击事件后,从 JS 文件 1 中的函数调用 JS 文件 2 中定义的函数失败
- 加载资源404(未找到)失败-文件位置错误