AlexGustafsson / homebridge-wol

A Wake on Lan plugin for Homebridge
MIT License
297 stars 30 forks source link

error when installing plugin #22

Closed jortkarst closed 7 years ago

jortkarst commented 7 years ago

Hi,

when i try to install the plugin i keep getting this error:

> raw-socket@1.5.1 install /usr/lib/node_modules/homebridge-wol/node_modules/raw-socket
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/homebridge-wol/node_modules/raw-socket/build'
gyp ERR! stack     at Error (native)
gyp ERR! System Linux 4.8.0-36-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/homebridge-wol/node_modules/raw-socket
gyp ERR! node -v v6.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! raw-socket@1.5.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the raw-socket@1.5.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jort/.npm/_logs/2017-07-20T19_03_06_798Z-debug.log

I don't know what I am doing wrong, since im an inexperienced coder! would love to get an experts opinion on this!

thank you, Jort

AlexGustafsson commented 7 years ago

It seems to be a permission error. Could you try sudo npm install homebridge-wol?

jortkarst commented 7 years ago

when i enter sudo npm install homebridge-wol, the plugin seems to install just fine. However it doesn't appear in my homebridge plugins! I think this is because it isn't installed globally! (this is the way it is instructed on this thread.)

when i try sudo npm install -g homebridge-wol I get all those errors again!

thank you for your quick response btw ^^

AlexGustafsson commented 7 years ago

That was a typo on my part, yes -g is required. What are your node and npm versions? node -v and npm -v should give you the information.

jortkarst commented 7 years ago

node version is v6.11.1 npm version is 5.3.0

AlexGustafsson commented 7 years ago

Have you created a separate Linux user to run node / homebridge? It may be that that user has the ownership rights to the folder while you don't.

If you're not familiar with that, chances are that something has become slightly "corrupted" and you (the current user) should in fact be the owner.

Running sudo chown -R $USER /usr/local should give your current user ownership of the folder where node_modules lives (used for storing modules).

Running npm cache clean should take care of any potential mishaps with package caching.

After running both those commands (given that you're not running node / homebridge as a separate user) you should be able to install the plugin as mentioned in the documentation.

If you're not familiar with Linux permissions I suggest you try to google this issue as there are many cases similar issues have come up. I believe it helps building an understanding of the problem by seeing how others have tackled the problem. But it's anything but trivial when you first start out.

Best of luck!

AlexGustafsson commented 7 years ago

If you're unable to solve the problem, feel free to re-open the issue.