This all seems good... It should be able to find the module where it is.
What command are you using to run your script and where are you invoking it
from?

-John
On May 13, 2015 11:55 AM, "Michael Deremer" <michaeldereme...@gmail.com>
wrote:

> I have nodejs installed on a debian distro on my raspberry pi. I have
> installed nodejs and npm successfully.
>
> I wanted to install the pi-gpio module so i could nodejs to access my gpio
> pins.
>
> I'm using the root user to cancel out permissions errors. I realize thats
> unsafe and i have a user setup using the quick2wire-gpio-admin utility.
>
> I navigate to my project folder: /usr/michael/
> the director listing looks like:
> controller.js   - this is my program. It starts a webserver and attempts
> to do var gpio = require('pi-gpio') and then read a gpio pin.
>
> While in my /usr/michael director i did an npm install pi-gpio.
> The install was successful and it placed a node-module folder within my
> project folder.
>
> documentation here: https://www.npmjs.com/package/pi-gpio specifies to
> include the module by using
> var gpio = require("pi-gpio");
>
> My absolute path for the pi-gpio module looks like:
> /usr/michael/node-module/pi-gpio/pi-gpio.js
>
> When i require the file as the example states i get an error saying it
> "cannot find module".
> Do i need to modify the require path? Are my permissions screwed up.
> I've tried:
>  require('pi-gpio')
> require('./node-module/pi-gpio')
> require('./node-module/pi-gpio/pi-gpio.js')
>
> Can someone explain what that require function is looking for?
>
> var gpio = require("pi-gpio");
>
> gpio.read(16, function(err, value) {
>     if(err) throw err;
>     console.log(value); // The current state of the pin
> });
>
>  --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+unsubscr...@googlegroups.com.
> To post to this group, send email to nodejs@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/97706a8b-2347-4b09-86da-cee6b9e1db19%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/97706a8b-2347-4b09-86da-cee6b9e1db19%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAMbK04ze4eQ0Po3XsjYTpmQHH_0LQHQ9u%3DJoA9XHe02m0adtjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to