How do I add dependencies?

368 views
Skip to first unread message

Dane Summers

unread,
Oct 7, 2011, 9:43:46 AM10/7/11
to spi...@googlegroups.com
I'm having trouble adding the d3 dependency, help would be appreciated!

I posted it to stack overflow initially because I was a little slow last night and totally neglected to look at the Spine support page...


----

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?

Alex MacCaw

unread,
Oct 7, 2011, 10:28:41 AM10/7/11
to spi...@googlegroups.com
Adding d3 to both the package.json and slug.json should do the trick, then run:

 npm install .

Can you try that again and let me know if there's still an issue.

Cheers,
Alex

Dane Summers

unread,
Oct 7, 2011, 12:22:15 PM10/7/11
to spi...@googlegroups.com
Still no go...

Here is my slug file:

{
  "dependencies": [
    "es5-shimify", 
    "json2ify", 
    "jqueryify", 
    "spine",
    "d3",
    "spine/lib/local",
    "spine/lib/ajax",
    "spine/lib/route",
    "spine/lib/tmpl",
    "spine/lib/manager"
  ],
  "libs": []
}

And here is my package.json file:

{
  "name": "app",
  "version": "0.0.1",
  "dependencies": { 
    "ace": "~0.0.1",
    "hem": "~0.1.2",
    "d3": "~2.3.2",
    "es5-shimify": "~0.0.1",
    "json2ify": "~0.0.1",
    "jqueryify": "~0.0.1",
    "spine": "~1.0.0"
  }
}

I tried the following sequence of commands:

npm install .
hem build

Anything look obviously wrong there?

Thanks!

Alex MacCaw

unread,
Oct 7, 2011, 12:29:37 PM10/7/11
to spi...@googlegroups.com
Ah, that's because the d3 library isn't specifying it's main file (d3.js) in the package.json (as the 'main' property).

You can fix this by, in slug.json, requiring 'd3/d3':

{
  "dependencies": [
    "es5-shimify", 
    "json2ify", 
    "jqueryify", 
    "spine",
    "d3/d3",
    "spine/lib/local",
    "spine/lib/ajax",
    "spine/lib/route",
    "spine/lib/tmpl",
    "spine/lib/manager"
  ],
  "libs": []
}

Dane Summers

unread,
Oct 7, 2011, 2:18:25 PM10/7/11
to spi...@googlegroups.com
that did it, thanks!

Dane Summers

unread,
Oct 13, 2011, 5:19:17 PM10/13/11
to Spine
Just curious - how would I find the maintainer of the d3 node.js
package...say, if I were gonna contact them and ask them to include
the 'main' key in their package.json file...is it just the library
author?

Alex MacCaw

unread,
Oct 13, 2011, 5:21:00 PM10/13/11
to spi...@googlegroups.com
npm info d3 :) - mbos...@gmail.com

Miles Matthias

unread,
Dec 5, 2013, 6:18:21 PM12/5/13
to spi...@googlegroups.com
I'm trying to install fastclick exactly like dane tried to install d3, except fastclick does list a main property: https://github.com/ftlabs/fastclick/blob/master/package.json#L26

yet I'm getting the same results. 
Reply all
Reply to author
Forward
0 new messages