hybridgroup / cylon-digispark

Cylon adaptor for the Digispark USB development board
http://cylonjs.com
Other
2 stars 0 forks source link

Dependency weirdness #12

Closed blalor closed 10 years ago

blalor commented 10 years ago

I have the following dependencies listed in my package.json:

  "dependencies": {
    "cylon": "^0.14.0",
    "cylon-digispark": "git+https://github.com/hybridgroup/cylon-digispark.git#893c07a2193a8d58866fac5a7443b91e65408898"
  }

The following simple program fails to run:

"use strict";

require("cylon").robot({
    connections: [
        { name: "digispark", adaptor: "digispark" }
    ],
}).start();

The output is

$node gpio.js 
I, [2014-06-09T00:00:48.794Z]  INFO -- : Initializing connections...
I, [2014-06-09T00:00:48.809Z]  INFO -- : Initializing connection 'digispark'...
D, [2014-06-09T00:00:48.810Z] DEBUG -- : Loading adaptor 'digispark'
D, [2014-06-09T00:00:48.823Z] DEBUG -- : registering digispark adaptor for Robot 13128
D, [2014-06-09T00:00:48.823Z] DEBUG -- : Registering GPIO AnalogSensor driver for Robot 13128
Cannot find the 'cylon-gpio' module. Please install it with 'npm install cylon-gpio' and try again.

re https://github.com/hybridgroup/cylon-digispark/commit/f8514e42116632f1e81ec5ae8abf3c737718f8ed#commitcomment-6594990

stewart commented 10 years ago

Due to the way that Node's dependency tree works, you also need to install cylon-gpio alongside cylon-digispark.

$ npm install cylon cylon-gpio cylon-digispark
$ node gpio.js

Should get you where you need to be.

blalor commented 10 years ago

I did get it to work by doing that, but it's non-intuitive. I wonder if twiddling some peerDependencies would make this simpler. I mean, it makes sense that I'd need to depend upon cylon and cylon-digispark in my project, but cylon-gpio is an implementation detail; I shouldn't need to provide it in my own project.

stewart commented 10 years ago

It's something we're looking into, but complex to get working due to the weird cross-dependencies we have with Cylon.

stewart commented 10 years ago

This has been fixed in the latest release, npm install cylon-digispark will now install: