ReferenceError:虽然在Layout.jade中添加了jQuery,但未定义$

时间:2016-06-13 13:24:39

标签: javascript jquery node.js

尝试在Node.js中运行一些基本的JavaScript代码时出现此错误

 ReferenceError: $ is not defined                                                                                                                                                                                                       
        at Object.<anonymous> (/home/ubuntu/workspace/nodetest2/public/javascripts/global.js:5:1)                                                                                                                                          
        at Module._compile (module.js:409:26)                                                                                                                                                                                              
        at Object.Module._extensions..js (module.js:416:10)                                                                                                                                                                                
        at Module.load (module.js:343:32)                                                                                                                                                                                                  
        at Function.Module._load (module.js:300:12)                                                                                                                                                                                        
        at Module.runMain [as _onTimeout] (module.js:441:10)                                                                                                                                                                               
        at Timer.listOnTimeout (timers.js:92:15)            

在我的Layout.jade中,我添加了

     script(src='http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js')
     script(src='/public/javascripts/global.js')

感谢您的帮助。

0 个答案:

没有答案