homebridge / docker-homebridge

Homebridge Docker. HomeKit support for the impatient using Docker on x86_64, Raspberry Pi (armhf) and ARM64. Includes ffmpeg + libfdk-aac.
https://hub.docker.com/r/homebridge/homebridge/
GNU General Public License v3.0
2.57k stars 241 forks source link

Cannot install plugin from GitHub via https using startup.sh #460

Closed benzman81 closed 2 years ago

benzman81 commented 2 years ago

Describe The Bug

Hi, i cannot install my plugin via https GitHub url using startup.sh.

I tried npm install https://github.com/benzman81/homebridge-nukiio.git leading to a permission error and hb-service add https://github.com/benzman81/homebridge-nukiio.git seems to be unsupported.

Even npm install homebridge-nukiio doesnt seem to work. Installation seems good, but homebridge tells me, that it does not find the plugin.

Only hb-service add homebridge-nukiio works as expected.

Until yesterday the command pnpm install https://github.com/benzman81/homebridge-nukiio.git worked, but I saw you changed back to npm, so I wanted to change, too.

Docker Config

Latest image.

Logs

No response

Host Operating System

Synology DSM 6

Host Architecture

x86_64 / amd64

oznu commented 2 years ago

The syntax would be: npm install benzman81/homebridge-nukiio

benzman81 commented 1 year ago

Please reopen. I tried your syntax as first, but this also fails with:

root@DiskStation:/homebridge $ npm install benzman81/homebridge-weather-plus                                             
npm ERR! code 128                                                                                                        
npm ERR! An unknown git error occurred                                                                                   
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/benzman81/homebridge-weather-plus.git           
npm ERR! No user exists for uid 1024                                                                                     
npm ERR! fatal: Could not read from remote repository.                                                                   
npm ERR!                                                                                                                 
npm ERR! Please make sure you have the correct access rights                                                             
npm ERR! and the repository exists.                                                                                      

npm ERR! A complete log of this run can be found in:                                                                     
npm ERR!     /home/homebridge/.npm/_logs/2022-08-24T19_04_48_971Z-debug-0.log                                            

Also tried npm install git+https://github.com/benzman81/homebridge-weather-plus.git which also fails with the same error. Seems that nom always falls back to ssh which I don't want. Maybe its related to this: https://github.com/npm/cli/issues/2610.

Before my initial comment it worked, don't know what changed in the image that caused this.

jptaranto commented 1 year ago

I might be experiencing this too for the deps on https://www.npmjs.com/package/homebridge-roon-outputs

  "dependencies": {
    "node-roon-api": "github:RoonLabs/node-roon-api",
    "node-roon-api-status": "github:RoonLabs/node-roon-api-status",
    "node-roon-api-transport": "github:RoonLabs/node-roon-api-transport"
  },
Homebridge    | npm ERR! code 128
Homebridge    | npm ERR! An unknown git error occurred
Homebridge    | npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/RoonLabs/node-roon-api.git
Homebridge    | npm ERR! No user exists for uid 1000
Homebridge    | npm ERR! fatal: Could not read from remote repository.
Homebridge    | npm ERR!
Homebridge    | npm ERR! Please make sure you have the correct access rights
Homebridge    | npm ERR! and the repository exists.
Homebridge    |
Homebridge    | npm ERR! A complete log of this run can be found in:
jptaranto commented 1 year ago

Ok, yeah it's occurring because npm is running git with ssh (not https) - under a user that doesn't exist, and even after recreating the user it'll fail without ssh keys setup. Definitely related to https://github.com/npm/cli/issues/2610

jptaranto commented 1 year ago

A quickfix/hack for now. Force npm to use https instead of ssh, and make sure the npm cache dir is writable.

You can do this from a new Dockerfile:

FROM oznu/homebridge

RUN npm config set cache /homebridge/.npm --location=global
RUN git config --global url."https://".insteadOf ssh://
niksauer commented 1 year ago

Didn't work for me in a new Dockerfile but rather putting it at the beginning of startup.sh.

@oznu Can we please still fix this in the upstream image?