Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.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
Express js render pug | ejs文件抛出Jquery错误_Jquery_Express_Pug_Electron_Ejs - Fatal编程技术网

Express js render pug | ejs文件抛出Jquery错误

Express js render pug | ejs文件抛出Jquery错误,jquery,express,pug,electron,ejs,Jquery,Express,Pug,Electron,Ejs,我对ExpressJs渲染和Jquery有问题 我的app.js(主文件)是 我的index.pug文件(我也一直在使用EJS)是 它向我抛出了一个找不到jquery模块的错误 如果我删除窗口。$=window.jQuery=module.export(我甚至尝试了=require(“jQuery”)而不是module export),简单的javascript会向我显示警报 我甚至尝试将jquery脚本链接到cdn存储库。我总是犯错误 我甚至尝试过在没有公共/静态分配的情况下将所有文件移动到根

我对ExpressJs渲染和Jquery有问题

我的app.js(主文件)是

我的index.pug文件(我也一直在使用EJS)是

它向我抛出了一个找不到jquery模块的错误 如果我删除
窗口。$=window.jQuery=module.export
(我甚至尝试了
=require(“jQuery”
)而不是module export),简单的javascript会向我显示警报

我甚至尝试将jquery脚本链接到cdn存储库。我总是犯错误

我甚至尝试过在没有公共/静态分配的情况下将所有文件移动到根文件夹

似乎什么都不管用。。。
我错过了什么

是否检查jquery文件的有效路径

然后只需使用下面的干净语法:

html
  head
   title= title
   script(src='/js/jquery-3.1.1.min.js')
   script.
     jQuery(function ($) {
       alert('ready');
     });
   body
     rows

据我所知,使用express和render似乎不会使用服务器端(NodeJS)功能,如require等。因此,我将所有逻辑移到主js文件和渲染文件中,仅用于视图。
 html
  head
   title= title
   script(src='/js/jquery-3.1.1.min.js')
   script.
     window.$ = window.jQuery = module.export;
     $().ready(function(){console.log("READY")});
     (alert("HELOOOOOOOOOOOOOOOOO"))
   body
     rows
html
  head
   title= title
   script(src='/js/jquery-3.1.1.min.js')
   script.
     jQuery(function ($) {
       alert('ready');
     });
   body
     rows