On May 13, 2015, at 1:55 PM, Michael Deremer <[email protected]> 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.
> 


Michael, do you mean “node_modules"?

        —ravi


> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/nodejs/97706a8b-2347-4b09-86da-cee6b9e1db19%40googlegroups.com.
> 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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/FDE54A33-4AD7-4B4A-BAAB-92B3BFEC9AE1%40g8o.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to