Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
以MIME类型text/html传输的方式运行时从expressjs获取错误_Html_Express_Content Type - Fatal编程技术网

以MIME类型text/html传输的方式运行时从expressjs获取错误

以MIME类型text/html传输的方式运行时从expressjs获取错误,html,express,content-type,Html,Express,Content Type,我作为本地服务器运行expressjs。我得到了这样的错误。。这里怎么了 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:3000/js/lib/bootstrap/dist/css/bootstrap.min.css". localhost/:11 Resource interpreted as Script but transferred with M

我作为本地服务器运行
expressjs
。我得到了这样的错误。。这里怎么了

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:3000/js/lib/bootstrap/dist/css/bootstrap.min.css".
localhost/:11 Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/js/lib/angular/angular.min.js".
localhost/:10 Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/js/lib/jquery/dist/jquery.min.js".
localhost/:12 Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/js/scripts/app.js".
这是我的html:

<!DOCTYPE html>
<html ng-app="myNewApp">
<head>
    <meta charset="utf-8"> //i already declared the content type here.
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>My New App!</title>
    <link rel="stylesheet" href="/js/lib/bootstrap/dist/css/bootstrap.min.css">
</head>
<body>
    <script src="/js/lib/jquery/dist/jquery.min.js"></script>
    <script src="/js/lib/angular/angular.min.js"></script>
    <script src="/js/scripts/app.js"></script>
</body>
</html>

我将所有
lib
资产移动到
public
目录。它是有效的。

为什么
app.get('*',…
而不是
app.get('/',…
?我想两者都是一样的。
*
小心点……我不这么认为。试着把它换掉,看看吧
var express = require("express"),
    app = express();

app

    .use(express.static( __dirname + 'public'));


app

    .get('*', function (req, res) {
        res.sendfile('public/main.html');
    })


app.listen(3000);