title: Error when loading jQuery: "Uncaught TypeError: Cannot read property 'exports' of null "
body: <p>I'm working on a bookmarklet that requires jQuery and have run into a problem on a website. </p>
  
  <p>When I try loading jQuery on <a href="http://www.toysrus.com/product/index.jsp?productId=21973566&amp;cp=2255956.2273442.2255964.20469696.19948766&amp;parentPage=family" rel="nofollow">toysrus.com</a>, using this code:</p>
  
  <pre><code>var element = document.createElement("script");
  element.onload=function() {
      jQuery.noConflict();
  }
  element.src = "//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js";
  document.body.appendChild(element);
  </code></pre>
  
  <p>This error is shown in the console:</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'exports' of null 
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/kNLaN.png" rel="nofollow">Screenshot</a>.</p>
  
  <p>The error points to the second line of code in the file:</p>
  
  <pre><code>if ( typeof module === "object" &amp;&amp; typeof module.exports === "object" ) {
  </code></pre>
  
  <p>From what I understand, it's perfectly fine to load jQuery more than once as long as <code>noConflict()</code> is called, which I'm doing, and this error only seems to be happening on this one website. </p>
  
  <p>Why is the error occurring and what can I do to fix it?</p>
  
  <p>UPDATE:</p>
  
  <p>Running the code from the line the error is occurring on in the browser causes the same error:</p>
  
  <pre><code>typeof module === "object" &amp;&amp; typeof module.exports === "object"
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>TypeError: Cannot read property 'exports' of null
  </code></pre>
  
  <p>I'm confused why the error is being thrown, since if <code>module.exports</code> doesn't exist, should the console just output <code>undefined</code>?</p>