Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.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
Javascript 为什么我的jQuery没有加载文件?_Javascript_Jquery_Node.js_Express - Fatal编程技术网

Javascript 为什么我的jQuery没有加载文件?

Javascript 为什么我的jQuery没有加载文件?,javascript,jquery,node.js,express,Javascript,Jquery,Node.js,Express,我导入jQuery,像这样在我的脑海中出现boostrap <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3

我导入jQuery,像这样在我的脑海中出现boostrap

<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"</script>
但是当我的页面被加载时,那些lib不会被加载。 我也有一些图片

    <div class="item active">
          <a href="vungtau.html">
          <img src="IntroduceImage/VungTau.jpg" alt="Vũng Tàu">
          <div class="carousel-caption">
            <h3>Vũng Tàu</h3>
            <h4>Lần đầu đi Vũng Tàu bằng xe máy</h4>
          </div>
          </a>
        </div>

它们也没有加载。这是地址:D:\Atom Project\IntroductionImage\VungTau.jpg

有人知道为什么吗? 我加载它时没有像这样的节点file:///D:/Atom%20Project/main.html. 他们都上膛了。 请帮忙,我是新来的


提示如下

app.use('/static', express.static(path.join(__dirname)));

http://localhost:3000/static/images/kitten.jpg
http://localhost:3000/static/css/style.css
http://localhost:3000/static/js/app.js
http://localhost:3000/static/images/bg.png
http://localhost:3000/static/hello.html
通过这个链接

https://expressjs.com/en/starter/static-files.html

您必须按照中的给定提供文件引用路径

大概

const path = require('path');

app.use(express.static('./'));
app.use(express.static(path.join(__dirname, 'public')));

我的映像存储在服务器的根目录中。

查看express文档有express.static来配置应用程序的根路径,然后根据该相对路径提供文件参考。请参考此文档,将使用NodeJS+express的文件包括到您的项目中。谢谢,@ManpreetMatharu,与您的链接进行比较,并尝试进行一些搜索。我做到了。它真的需要“pp.use(express.static(path.join(u dirname,'public'));”吗?我只使用“app.use(express.static('./');”,如果您在公共目录中有一个外部文件,那么它可以正常工作,@NguyenHoangVu-K11FUGHCM欢迎使用
const path = require('path');

app.use(express.static('./'));
app.use(express.static(path.join(__dirname, 'public')));