无法加载资源404(未找到)

编程入门 行业动态 更新时间:2024-10-10 03:30:50
本文介绍了无法加载资源404(未找到) - 文件位置错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在构建一个Angular 2应用程序,我刚刚升级到Net Core RC2。在升级之前,我的网页显示得很好,但现在我的Chrome Dev Tools控制台出现错误:

I'm building an Angular 2 app which I just upgraded to Net Core RC2. Prior to the upgrade, my webpage would display just fine, but now I am getting errors in my Chrome Dev Tools console:

Failed to load resource: the server responded with a status of 404 (Not Found): localhost:5000/lib/bootstrap/dist/js/bootstrap.min.js Failed to load resource: the server responded with a status of 404 (Not Found): localhost:5000/lib/bootstrap/dist/css/bootstrap/bootstrap.min.css

我的package.json文件中有3.3.6版本的bootstrap。我用 npm install 命令安装它。它在我的Visual Studio项目中正确安装。这些文件位于:

I have bootstrap in my package.json file with version 3.3.6. I installed it with an npm install command. It installed properly in my Visual Studio project. The files are located at:

项目 - > node_modules - > bootstrap - > dist - > js - > boostrap.min.js

项目 - > node_modules - > bootstrap - > dist - > css - > boostrap.min .css

我的gulpfile有这个部分:

My gulpfile has this section:

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.cshtml文件中看到对bootstrap.min.js的引用:

I'm also seeing a reference to bootstrap.min.js in a _Layout.cshtml file:

<!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>

我是网络开发的新手,所以我不完全确定发生了什么。有人能指出我正确的方向吗?

I'm new to web development so I'm not completely sure what's happening. Could someone point me in the right direction?

推荐答案

看起来您提供的路径中没有任何引导程序文件。

Looks like the path you gave doesn't have any bootstrap files in them.

href="~/lib/bootstrap/dist/css/bootstrap.min.css"

确保文件存在于那里,否则将文件指向正确的路径,这应该是你的情况

Make sure the files exist over there , else point the files to the correct path, which should be in your case

href="~/node_modules/bootstrap/dist/css/bootstrap.min.css"

更多推荐

无法加载资源404(未找到)

本文发布于:2023-08-03 04:39:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1284030.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:未找到   加载   资源

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!