wacekz / homebridge-rpi-garage-door-opener

Plugin for HomeBridge for a Raspberry Pi GPIO Garage Door Opener
2 stars 2 forks source link

Error on install #1

Open ravedoglv opened 6 years ago

ravedoglv commented 6 years ago

When attempting to install the plugin i get an error. Any ideas?

npm ERR! code 128
npm ERR! Command failed: /usr/bin/git clone -q git://github.com/wacekz/homebridge-rpi-garage-door-opener.git /root/.npm/_cacache/tmp/git-clone-9f42da88
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-9f42da88': Permission denied
npm ERR! 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-04-27T06_37_55_560Z-debug.log

The log file shows:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli   '/usr/bin/npm',
1 verbose cli   'install',
1 verbose cli   'github:wacekz/homebridge-rpi-garage-door-opener',
1 verbose cli   '-g' ]
2 info using npm@5.6.0
3 info using node@v8.11.1
4 verbose npm-session cb02dc070e876a43
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for github:wacekz/homebridge-rpi-garage-door-opener Command failed: /usr/bin/git clone -q git://github.com/wacekz/homebridge-rpi-garage-door-opener.git /root/.npm/_cacache/tmp/git-clone-9f42da88
7 silly fetchPackageMetaData fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-9f42da88': Permission denied
8 verbose stack Error: Command failed: /usr/bin/git clone -q git://github.com/wacekz/homebridge-rpi-garage-door-opener.git /root/.npm/_cacache/tmp/git-clone-9f42da88
8 verbose stack fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-9f42da88': Permission denied
8 verbose stack
8 verbose stack     at ChildProcess.exithandler (child_process.js:275:12)
8 verbose stack     at emitTwo (events.js:126:13)
8 verbose stack     at ChildProcess.emit (events.js:214:7)
8 verbose stack     at maybeClose (internal/child_process.js:925:16)
8 verbose stack     at Socket.stream.socket.on (internal/child_process.js:346:11)
8 verbose stack     at emitOne (events.js:116:13)
8 verbose stack     at Socket.emit (events.js:211:7)
8 verbose stack     at Pipe._handle.close [as _onclose] (net.js:567:12)
9 verbose cwd /home/pi
10 verbose Linux 4.14.34-v7+
11 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "github:wacekz/homebridge-rpi-garage-door-opener" "-g"
12 verbose node v8.11.1
13 verbose npm  v5.6.0
14 error code 128
15 error Command failed: /usr/bin/git clone -q git://github.com/wacekz/homebridge-rpi-garage-door-opener.git /root/.npm/_cacache/tmp/git-clone-9f42da88
15 error fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-9f42da88': Permission denied
16 verbose exit [ 1, true ]
wacekz commented 6 years ago

I’m sorry but I’m not able to help with problems dealing with npm and installation. I just don’t know enough. I ran some searches though. People claim issues similar to yours may be related to npm version, permissions, using sudo when not needed, using root etc. Nothing consistent. You may also check npm documentation for other possible commands that can install directly from github. One more thing. Are you able to install other npm packages on your system? Let me know if you’re able to solve the issue you have. Good luck.

jadomski commented 2 years ago

I had the same error when using the version of NodeJS which came with Raspbian and running npm as root

I worked around the issue by installing NodeJS through N using n-install to get latest LTS and then installing homebridge and this plugin without sudo (but still with -g).

In order to run it as a service I used pm2 which allowed me to keep it running under my uid. End result is great - homebridge launches at boot and this plug-in has full access to the GPIO pins.

NolanWelser commented 2 years ago

I too had this issue, and I just want to add that I followed @jadomski's comment and installed node using n-install on raspberry pi os lite, installed homebridge without sudo, ran the install command from this repo's instructions without sudo, and it all worked perfectly fine. For the life of me I could not figure out how to make the permissions work using either the official homebridge pi image, or following the official instructions to install on top of RPiOS.