0

I'm really confused as to what is going on here. With d3 2.10.1, the require 'd3' call generates an error about jsdom in this line of d3's index.js:

document = require("jsdom").jsdom("<html><head></head><body></body></html>");

jsdom was in d3's node_modules folder from npm install. However, even if I install jsdom directly as a dependency in package.json/slug.json, I get the same error. The problem is the following when requiring d3, thrown at that line above:

Uncaught module jsdom not found 

This happens for older versions of d3 (2.8.1) as well. I am using d3 in a Spine/hem/npm app and have no idea what is causing this. For now, I've just required the d3.v2.min.js script, but that is just a temporary hack.

Hope you node warriors can help me out!

Andrew Mao
  • 35,740
  • 23
  • 143
  • 224

1 Answers1

0

This seems to be fixed by doing the following:

require 'd3/d3.v2'

Apparently, the normal require 'd3' (getting the index.js) is for server-side non-browser use, so you want the above if you are using npm to write a client side app.

Andrew Mao
  • 35,740
  • 23
  • 143
  • 224