Search code examples
javascriptnode.jsd3.jsspine.js

How can I add dependencies to my Spine app?


I'm trying to make a new spine javascript app using d3 (generated using Spine.app). I tried the following:

  1. Edit slug.json, and add "d3" to the dependencies array.
  2. Run "npm install ."
  3. Run "hem build"

Hem complains:

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Cannot find module: d3. Have you run `npm install .` ?

I've tried manually adding d3 to package.json and I've tried manually installing d3 using "npm install -g d3". But I still get the same error.

Any pointers? How do I add dependencies to my spine project?


Solution

  • The answer was that the 'd3' module did not reference its 'main' js file in its package. So in order to install d3 in my spine app I had to do two things:

    reference 'd3/d3' in my slug.json file.
    reference d3 as "d3": "~2.3.2" in my package.json file.
    

    This should be fixed in 2.5.0 of d3 - I opened a defect with the d3 owner and he emailed me that he fixed it yesterday.