2016-06-28 261 views
0

我正在構建一個我剛剛升級到Net Core RC2的Angular 2應用程序。在升級之前,我的網頁將顯示就好了,但現在我在我的Chrome瀏覽器開發工具控制檯收到錯誤:無法加載資源404(未找到) - 文件位置錯誤?

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版本。我安裝了一個npm install命令。它在我的Visual Studio項目中正確安裝。該文件位於:

項目 - > node_modules - >引導 - > DIST - > JS - > boostrap.min.js

項目 - > node_modules - >引導 - > 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.cshtml文件bootstrap.min.js參考:

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

我新的Web開發,所以我不能完全肯定發生了什麼。有人能指出我正確的方向嗎?

+0

如果你把這些URL地址欄,可以看到文件或給你一個404? – Jer

+0

我沒有得到任何錯誤,但我也沒有看到這些文件(他們只是黑色的網頁)。當我導航到http:// localhost:5000時,我只會遇到錯誤。其他文件,如我的main.bundle.js確實顯示出來。 – Roka545

+1

也許你可以看看這裏:http://stackoverflow.com/questions/17775944/node-js-keep-getting-failed-to-load-resource-error-message我希望這是一個有用的文章/問題 – Jer

回答

3

看起來你所給的路徑中沒有任何引導文件。

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

確保存在在那裏的文件,否則文件指向正確的路徑,這應該是你的情況

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

感謝您的回覆。原來我的webpack.config.js文件中有一個自定義命令,它運行腳本來自動生成'lib'文件夾。 – Roka545

相關問題