Everything installed and referenced: ReferenceError: jQuery is not defined


If I run it in the browser, everything works as expected. If i do it in Webstorm itself, I get:

/usr/local/bin/node app.js




ReferenceError: jQuery is not defined

    at Object.<anonymous> (/Users/Merl/WebstormProjects/untitled/app.js:8:1)

    at Module._compile (module.js:460:26)

    at Object.Module._extensions..js (module.js:478:10)

    at Module.load (module.js:355:32)

    at Function.Module._load (module.js:310:12)

    at Function.Module.runMain (module.js:501:10)

    at startup (node.js:129:16)

    at node.js:814:3

Process finished with exit code 1

This is the HTML:

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">


<script src="jquery.js" type="text/javascript"></script>
<script src="app.js" type="text/javascript"></script>

And this is app.js:

$(document).ready(function() {
   $('source[src]').each(function () {


I've tried calling jQuery from the cdn, i've tried the minified version, the unminified, i've tried downloading it, i've tried referencing in Webstorm's library and without it...

The fun thing is that jQuery intellisense works perfectly, but when I run it, it says it doesn't recognize it!:_|


Comment actions Permalink

This seems like a very trivial thing and I can't get it working following the available doc. What am I missing?

Comment actions Permalink

Hi there,

First of all -- what are you trying to do? Execute your page/JavaScript in browser or nodejs app?

Based on a code (and presence of .html file) it's first one. In such case -- why do you run it as a NodeJS app? -- it is a completely different thing.

For running JavaScript in browser:

NOTE: You have to execute your .html file and not .js file.

For executing NodeJS apps:

NOTE: Here you execute .js file directly.


Please sign in to leave a comment.