Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install failure - ffmpeg-for-homebridge dependency error #1072

Closed
ammacdonald3 opened this issue Oct 16, 2022 · 18 comments
Closed

Install failure - ffmpeg-for-homebridge dependency error #1072

ammacdonald3 opened this issue Oct 16, 2022 · 18 comments
Labels
bug Something isn't working

Comments

@ammacdonald3
Copy link

Bug Report

Describe the Bug

Upon attempting to install homebridge-ring through the Homebridge UI, the process fails with the error message below. It seems as if it may be failing when attempting to install the ffmpeg-for-homebridge@0.1.4 dependency? If so, any ideas? This is an entirely fresh version of homebridge (Docker) with a fresh version of the latest homebridge-ring. Thanks!

To Reproduce

Steps to reproduce the behavior:

  • Start Homebridge
  • Attempt to install homebridge-ring through the UI
  • See error

Expected behavior

I expect homebridge-ring to install successfully without error.

Screenshots/Logs



USER: root
DIR: /var/lib/homebridge
CMD: npm install --save homebridge-ring@11.3.1

[##################] | reify:date-fns: http fetch GET 200 https://registry.npmjs.org/d

ffmpeg-for-homebridge@0.1.4 install
node install.js

node:internal/modules/cjs/loader:988s: http fetch GET 200 https://registry.npmjs.org/d
throw err;
^

Error: Cannot find module '/homebridge/node_modules/homebridge-ring/node_modules/ffmpeg-for-homebridge/install.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:22:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code 1
npm ERR! path /homebridge/node_modules/homebridge-ring/node_modules/ffmpeg-for-homebridge
npm ERR! command failed
npm ERR! command sh -c -- node install.js

npm ERR! A complete log of this run can be found in:
npm ERR! /home/homebridge/.npm/_logs/2022-10-16T21_30_58_267Z-debug-0.log

Operation failed. Please review log for details.



Additional context

I have successfully run homebridge-ring for over a year on a different device (Raspberry Pi), and I'm attempting a fresh install on a new device (Synology DS220+). In both cases, I'm running homebridge in a Docker container. I tried the following:

  • importing my original Homebridge backup
  • starting from a new Homebridge clean install
  • installing homebridge-ring through the web UI
  • installing homebridge-ring through the homebridge terminal

Homebridge Ring Config

Post homebridge-ring platform config without sensitive information


No config as the plugin will not install

Environment

  • OS: Docker on a Synology NAS (DSM7)
  • Node.js: 16.18.0
  • NPM: 8.19.2
  • homebridge-ring: latest (can't actually install)
  • homebridge: 1.5.0
  • hoobs: N/A
@ammacdonald3 ammacdonald3 added the bug Something isn't working label Oct 16, 2022
@ammacdonald3
Copy link
Author

This seems to be similar to Issue #632, except they already had homebridge-ring installed. When executing which ffmpeg in my homebridge terminal, I receive /usr/local/bin/ffmpeg. I tried manually updating my config file to reference this path instead of /usr/bin/ffmpeg, but that did not work.

@fpaddict
Copy link

I'm having the same issue...

@eoghanobrien
Copy link

I think the issue is that ffmpeg-for-homebridge assumes you have node in your $PATH, I was able to get around this by ssh'ing into the pi and adding my homebridge bin path /opt/homebridge/bin to my $PATH

$ nano ~/.bashrc
export PATH="/opt/homebridge/bin:$PATH"

Then when I run:

/opt/homebridge/bin/node /opt/homebridge/bin/npm i --location=global --unsafe-perm homebridge-ring@11.3.1

Everything worked fine. I'm not sure this is a problem that can be solved in this repo.

@ammacdonald3
Copy link
Author

@eoghanobrien thanks for the helpful info! I'm running Homebridge in Docker, so not sure how that would impact your proposed solution. Is this an issue with the Homebridge Docker image not installing node correctly?

@eoghanobrien
Copy link

eoghanobrien commented Oct 18, 2022

Possibly, I'd expect node and npm to be in /usr/local/bin just based on what I usually see.

@fpaddict
Copy link

I think the issue is that ffmpeg-for-homebridge assumes you have node in your $PATH, I was able to get around this by ssh'ing into the pi and adding my homebridge bin path /opt/homebridge/bin to my $PATH

$ nano ~/.bashrc
export PATH="/opt/homebridge/bin:$PATH"

Then when I run:

/opt/homebridge/bin/node /opt/homebridge/bin/npm i --location=global --unsafe-perm homebridge-ring@11.3.1

Everything worked fine. I'm not sure this is a problem that can be solved in this repo.

This didn't work for me. I'm on Raspberry Pi.

@tsightler
Copy link
Collaborator

If you just type node -v from a shell prompt, what is the output? The output of which node might also be interesting.

@eoghanobrien
Copy link

eoghanobrien commented Oct 20, 2022

This didn't work for me. I'm on Raspberry Pi.

@fpaddict What exactly didn't work?

Another thing you could try is updating the ~/.homebridge/package.json file manually and adding the package name and version:

"homebridge-ring": "11.3.1"

Then inside that same directory, run:

$(which node) $(which npm) -v

If either node or npm aren't on your $PATH you'll get an error pretty quick. If that works and you get the npm version back, then run:

$(which node) $(which npm) install

When I did this it installed the plugin as expected.

@fpaddict
Copy link

If you just type node -v from a shell prompt, what is the output? The output of which node might also be interesting.

I get v16.16.0

@fpaddict
Copy link

$(which node) $(which npm) install

8.11.0

@fpaddict
Copy link

I just ran it again after updating NPM to 8.19.2. It runs, don't get any failures but the plug in never shows up in Homebridge

pi@homebridge:~ $  npm i -g --unsafe-perm homebridge-ring
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated request-promise@4.2.6: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated @types/keyv@4.2.0: This is a stub types definition. keyv provides its own type definitions, so you do not need this installed.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

changed 222 packages, and audited 223 packages in 16m

21 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

@ammacdonald3
Copy link
Author

Thanks all! The solution mentioned above in @eoghanobrien's reply worked! After manually updating package.json to include homebridge-ring, it installed as expected over the command line.

In case it helps anyone else, these are the outputs of the requested commands above:
node -v
v16.18.0

which node
/opt/homebridge/bin/node

npm -v
8.19.2

which npm
/opt/homebridge/bin/npm

After running $(which node) $(which npm) install, part of my output indicated that ffmpeg-for-homebridge was installed correctly too:
ffmpeg has been downloaded to /volume1/docker/homebridge/node_modules/homebridge-ring/node_modules/ffmpeg-for-homebridge/ffmpeg

Finally, I had actually switched to @tsightler's ring-mqtt tool through Home Assistant, so really appreciate your help working through this on Homebridge too!

@eoghanobrien
Copy link

eoghanobrien commented Oct 20, 2022

@fpaddict it looks like you ran npm i -g --unsafe-perm homebridge-ring - my suggestion was to open your ~/.homebridge/package.json file, mine looks like:

{
  "dependencies": {
    "homebridge": "^1.5.0",
    "homebridge-ring": "11.3.1"
  }
}

Inside that directory, ~/.homebridge, run $(which node) $(which npm) install

@fpaddict
Copy link

Still no dice.
Edited the package.json:
image

Ran the command:
image

And tried installing homebridge-ring again. The log is over 1400 lines but this is the area where it errors out:
image

@eoghanobrien
Copy link

@fpaddict it looks like you're running this in your user directory ~ i.e. (/home/pi) make sure you're in /home/pi/.homebridge assuming that directory exists 🤷

@fpaddict
Copy link

Thank you all. I was definitely in the wrong directory.

image

I can see the Homebridge-Ring plugin and I'm able to configure it.

@eoghanobrien
Copy link

So to wrap this up @dgreif I think this issue due to the decision made by Homebridge team to keep the Homebridge node/npm installation bundled and isolated from the rest of the system (reasons available here: https://www.reddit.com/r/homebridge/comments/vusfib/homebridge_and_npm_node_locations_on_raspberry_pi/)

ffmpeg-for-homebridge has a package script install that expects to use the node binary included in the $PATH but since node and npm are now isolated, this specific reference to node can't be found.

I'm not sure what to next step is here to make this ffmpeg-for-homebridge package script more generally compatible, or if we even need to solve for this, given there's a work-around.

@dgreif
Copy link
Owner

dgreif commented Oct 23, 2022

Thanks for the community debugging everyone! I'm glad you were able to get this resolved. It seems like a similar issue pops up every few months, but I never have great advice on how to resolve it since it's an npm install issue, rather than a plugin issue. I'm going to close this as resolved, and I'll point future issues to this one for a solution.

@dgreif dgreif closed this as completed Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants