Jquery 无法获取静态文件

Jquery 无法获取静态文件,jquery,html,node.js,express,static-files,Jquery,Html,Node.js,Express,Static Files,我试图在我的ExpressJS应用程序中添加jQueryUIDateTime选择器,但出现了404错误 <p>Date: <input type="text" id="datepick"></p> <link rel="stylesheet" type="text/css" href="stylesheets/jquery.datetimepicker.css"/ > <script src="javascripts/jquery.js"&g

我试图在我的ExpressJS应用程序中添加jQueryUIDateTime选择器,但出现了404错误

<p>Date: <input type="text" id="datepick"></p>
<link rel="stylesheet" type="text/css"
href="stylesheets/jquery.datetimepicker.css"/ > <script
src="javascripts/jquery.js"></script> <script
src="javascripts/jquery.datetimepicker.js"></script>

<script type="text/javascript"> $(document).ready(function() {
    $("#datepick").datepicker(); }) 
</script>
EDIT1:控制台错误

GET /historicos/javascripts/jquery.datetimepicker.js 404 2.263 ms - 948
火狐错误

GET http://localhost:3000/historicos/stylesheets/jquery.datetimepicker.css [HTTP/1.1 404 Not Found 15ms]
GET http://localhost:3000/historicos/javascripts/jquery.js [HTTP/1.1 404 Not Found 28ms]
GET http://localhost:3000/historicos/javascripts/jquery.datetimepicker.js [HTTP/1.1 404 Not Found 26ms]
GET http://localhost:3000/historicos/javascripts/jquery.datetimepicker.js [HTTP/1.1 404 Not Found 3ms]
ReferenceError: $ is not defined historicos:25

假设您具有以下文件树:

/root
    /public
        /stylesheets
        /javascripts
    server.js
/root/server.js

 app.use(express.static(path.join(__dirname, '/public')));
 app.use('/historicos', express.static(path.join(__dirname, '/public')));
然后:

现在,如果希望url的前缀为/historicos,则需要将其指定为应用程序的第一个参数。use()函数:

/root/server.js

 app.use(express.static(path.join(__dirname, '/public')));
 app.use('/historicos', express.static(path.join(__dirname, '/public')));
现在您可以执行以下操作:

 GET http://localhost:3000/historicos/stylesheets/jquery.datetimepicker.css

您必须向我们展示为这些文件提供服务的express代码。node.js和Express默认情况下不提供任何文件。请查看开发控制台或服务器上的错误日志,准确地告诉我们是什么给了您404?更新错误您需要了解此处涉及的所有绝对路径。什么是
\uu dirname
?这些脚本标记所在的文件的URL是什么?这些文件所在的实际目录层次结构是什么?为什么要使用脚本的相对路径,这很容易引起混淆,而且肯定不是必需的?\uu dirname是一个与url相关的express变量,例如localhost:3000/historicos,文件层次结构是公共的,并且在其中包含javascripts和样式表