jperkin / node-rpio

Raspberry Pi GPIO library for node.js
858 stars 124 forks source link

Installation Troubles #72

Closed shard87 closed 5 years ago

shard87 commented 6 years ago

Can anybody help with this... I'm literally getting stuck at the start and its no doubt something obvious I've missed!

Any time I type npm install rpio I get this error:

_npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EAI_AGAIN: request to https://registry.npmjs.org/rpio failed, reason: getaddrinfo EAIAGAIN registry.npmjs.org:443 npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation. _npm WARN checkPermissions Missing write access to /home/pi/nodemodules/rpio npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json' npm WARN pi No description npm WARN pi No repository field. npm WARN pi No README data npm WARN pi No license field.

_npm ERR! path /home/pi/nodemodules/rpio npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access _npm ERR! Error: EACCES: permission denied, access '/home/pi/nodemodules/rpio' _npm ERR! { Error: EACCES: permission denied, access '/home/pi/nodemodules/rpio' _npm ERR! stack: 'Error: EACCES: permission denied, access \'/home/pi/nodemodules/rpio\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', _npm ERR! path: '/home/pi/nodemodules/rpio' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in: _npm ERR! /home/pi/.npm/_logs/2018-06-06T07_55_14019Z-debug.log

If I run as SUDO I get this:

_npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EAI_AGAIN: request to https://registry.npmjs.org/rpio failed, reason: getaddrinfo EAIAGAIN registry.npmjs.org:443 npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.

_> rpio@0.9.22 install /home/pi/nodemodules/rpio > node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.11.2" _gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/nodemodules/rpio/.node-gyp"

The last 2 lines will keep repeating themselves until I stop it.

Any explanations would be very appreciated!

WeeMan1990 commented 6 years ago

I got some issues with this plugin as well, yours should however be easily fixed by : sudo npm install --unsafe-perm rpio

shard87 commented 6 years ago

Thanks WeeMan,

I tried it but still had no luck:

pi@raspberrypi:~ $ sudo npm install --unsafe-perm rpio

rpio@0.9.22 install /home/pi/node_modules/rpio node-gyp rebuild

make: Entering directory '/home/pi/node_modules/rpio/build' CC(target) Release/obj.target/rpio/src/bcm2835.o CXX(target) Release/obj.target/rpio/src/rpio.o SOLINK_MODULE(target) Release/obj.target/rpio.node COPY Release/rpio.node make: Leaving directory '/home/pi/node_modules/rpio/build' npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json' npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json' npm WARN pi No description npm WARN pi No repository field. npm WARN pi No README data npm WARN pi No license field.

I assume it’s something ridiculous I’ve missed?

WeeMan1990 commented 6 years ago

what if you try § sudo npm install -g --unsafe-perm --verbose rpio?

WeeMan1990 commented 6 years ago

and also if you havn't done it already, check that you are a member of the GPIO group, § groups ${USER} and if the return doesn't show gpio then run § sudo usermod -a -g gpio pi And ofcourse in the above ''pi'' is the username as standard, if you have changed your username you'll have to replace ''pi'' with the real

AlexSSD7 commented 5 years ago

--unsafe-perm helped me! Thanks!

jperkin commented 5 years ago

This appears to be resolved now? Sorry, I can't do much about NPM's terrible UNIX permissions handling unfortunately :( The only thing I can do is highly highly highly recommend never using "-g" to install, it causes nothing but problems and makes either the operating system packagers or the module owners look bad.