NorthernMan54 / homebridge-cmd-television

20 stars 1 forks source link

Error: Cannot find module 'request' #9

Open Nastras opened 2 years ago

Nastras commented 2 years ago

Hello @NorthernMan54,

I would like to use your plugin. Thanks for your work!

Unfortunately I run into an error when I set it up your plugin and I can't figure out why. It looks like something is missing from the plugin? I have reinstalled it several times.

Attached is an excerpt from the log and my config.json.

I hope you can help me further? Thank you!

Bildschirmfoto 2022-01-31 um 14 17 02

e further?

Bildschirmfoto 2022-01-31 um 14 15 29
NorthernMan54 commented 2 years ago

Looks like the install failed, please try it again

sudo npm i -g https://github.com/NorthernMan54/homebridge-cmd-television

If this gives any errors, please share the log

Nastras commented 2 years ago

Hey thanks for the quick feedback. Yes there is an error when I enter the command:

Nastras@SHS-1:~ $ sudo npm i -g https://github.com/NorthernMan54/homebridge-cmd-television npm ERR! code 128 npm ERR! An unknown git error occurred npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/NorthernMan54/homebridge-cmd-television.git npm ERR! git@github.com: Permission denied (publickey). npm ERR! fatal: Konnte nicht vom Remote-Repository lesen. npm ERR! npm ERR! Bitte stellen Sie sicher, dass die korrekten Zugriffsberechtigungen bestehen npm ERR! und das Repository existiert.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2022-01-31T13_54_41_874Z-debug-0.log

NorthernMan54 commented 2 years ago

That looks like an issue with NPM, are you running an old or non-standard version of nodes/npm ?

Nastras commented 2 years ago

No I think I use the normal versions. These plugins I have all in use without problems when installing.

89ACD730-6519-43D2-85DC-519F08F58289 16ED0DCE-125B-47B4-B15A-DCB58F0224D0

NorthernMan54 commented 2 years ago

How about this

sudo npm i -g --unsafe-perm https://github.com/NorthernMan54/homebridge-cmd-television
Nastras commented 2 years ago

I have currently uninstalled your plugin. I had installed it with this and then the error from above occurred when starting: sudo npm install -g homebridge-cmd-television --unsafe-perm

Nastras commented 2 years ago

Does not go either 😞 I also tried it directly as root with (sudo su).

D4C19E95-D061-452F-AEF2-16EDA84229FA

Nastras commented 2 years ago

With this I can install it but then I get the error: Error: Cannot find module 'request'

F3683D07-AD7C-4555-9AF3-216BAB2B57CF

NorthernMan54 commented 2 years ago

I’m stumped

Another trick is to change to the directory where the plugin is installed, sudo su, then just run ‘npm install’

Nastras commented 2 years ago

I have now tried it on another Raspberry Pi 4. There also comes the installation error. Same npm and node version.

2E287FCA-CE49-4F37-9B51-2E97D2E6E3D8

Nastras commented 2 years ago

I’m stumped

Another trick is to change to the directory where the plugin is installed, sudo su, then just run ‘npm install’

Just tried. Also comes this installation error. It somehow looks like there is no permission to download the data.

Do you have the possibility to set something? Can you try to install it from a Pi if the error also occurs with you?

NorthernMan54 commented 2 years ago

What version of npm and nodejs are you running?

Nastras commented 2 years ago

I had already posted this above. Has probably gone under.

C34A6240-560B-4015-8CFF-DFC2B193289D

A-vesalius commented 2 years ago

I am getting similar when trying a new install on a debian 11 VM running latest homebridge and nodejs v16.13.2 npm v8.1.2

`homebridge@HomeBridge:/var/lib/homebridge$ sudo npm i -g --unsafe-perm https://github.com/NorthernMan54/homebridge-cmd-television npm ERR! code ENOENT npm ERR! syscall spawn git npm ERR! path git npm ERR! errno -2 npm ERR! enoent An unknown git error occurred npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2022-01-31T23_11_43_530Z-debug.log homebridge@HomeBridge:/var/lib/homebridge$`

NorthernMan54 commented 2 years ago

I just tested from my MacBook

sudo npm i -g --unsafe-perm https://github.com/NorthernMan54/homebridge-cmd-television
Password:
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
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 request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 48 packages, and audited 49 packages in 3s

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

found 0 vulnerabilities
Heisenberg:~ nm$ node -v
v16.13.2
Heisenberg:~ nm$ npm -v
8.1.2
Heisenberg:~ nm$ 

Something odd is going on here

Nastras commented 2 years ago

Yes that is very strange 😅

Can you maybe update the plugin so that a new version is available.

Maybe it works then?

ptpittman commented 2 years ago

I get the same error on my raspberry pi. What works as a fallback is to run:

sudo npm install -g --save https://github.com/NorthernMan54/homebridge-cmd-television/tarball/master

(in other words, getting npm to just download and install the tarball rather than to go via normal git channels)

It seems like there's something slightly askew in the repository setup here that's redirecting it to ssh and trying to use the 'git' user. This doesn't happen with other homebridge (or other) npm packages.

UKenGB commented 1 year ago

Not really been sorted. I tried both the manual install specified for this plug-in, but had the above problem. I also tried 2 other versions of the same plug-in (why multiple versions from different people) and same problem even when installing via Homebridge UI. Errors when Homebridge starts and tries to load the plug-in.

I then used:-

npm i -g --unsafe-perm https://github.com/NorthernMan54/homebridge-cmd-television

I was actually logged in as the user used by Homebridge (as for all other plug-ins) and this time no major errors and the accessory appears in Homebridge.

Now to see if it works…

UKenGB commented 1 year ago

Yes it works and I can turn the ATC on and off. So something odd about the install that seems then incomplete so the plug-in won't run and hence doesn't work.

Get past that though and it does seem to work, although I still find it enormously dumb that Apple exclude the Apple TV from being actually usable in HomeKit despite being a HK hub.

dineshpannu commented 1 year ago

Added this to Homebridge. Setup the config. Restarted Homebridge and got the same error:

[11/08/2022, 10:55:04 pm] ====================
[11/08/2022, 10:55:04 pm] ERROR LOADING PLUGIN homebridge-cmd-television:
[11/08/2022, 10:55:04 pm] Error: Cannot find module 'request'
Require stack:
- C:\Users\dines\AppData\Roaming\npm\node_modules\homebridge-cmd-television\index.js
- C:\Users\dines\AppData\Roaming\npm\node_modules\homebridge\lib\plugin.js
- C:\Users\dines\AppData\Roaming\npm\node_modules\homebridge\lib\pluginManager.js
- C:\Users\dines\AppData\Roaming\npm\node_modules\homebridge\lib\server.js
- C:\Users\dines\AppData\Roaming\npm\node_modules\homebridge\lib\cli.js
- C:\Users\dines\AppData\Roaming\npm\node_modules\homebridge\bin\homebridge
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\dines\AppData\Roaming\npm\node_modules\homebridge-cmd-television\index.js:1:15)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
[11/08/2022, 10:55:04 pm] ====================

npm i -g --unsafe-perm https://github.com/NorthernMan54/homebridge-cmd-television does not work for me either:

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -4058
npm ERR! enoent An unknown git error occurred
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\dines\AppData\Local\npm-cache\_logs\2022-08-11T15_00_32_782Z-debug-0.log
saschafiedler commented 1 year ago

As mentioned here the problem might be a problem with an incorrect installation of node.js. Try npm install request --save That worked for me.