无法加载资源404(未找到) - 文件位置错误? [英] Failed to load resource 404 (Not Found) - file location error?

查看:100
本文介绍了无法加载资源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): 
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

我的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(未找到) - 文件位置错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆