homebridge / homebridge-config-ui-x

The Homebridge UI. Monitor, configure and backup Homebridge from a browser.
https://homebridge.io
MIT License
2.63k stars 382 forks source link

Getting Type Error when Booting #969

Closed bearreth closed 3 years ago

bearreth commented 3 years ago

See https://github.com/oznu/homebridge-config-ui-x/issues/969#issuecomment-734022445


Describe The Bug: UI is not booting.

To Reproduce: Updated to 4.34.0

Expected behavior: A full boot of the UI.

Logs:

TypeError: Cannot assign to read only property 'toString' of object '#<Cancel>'
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-config-ui-x/node_modules/axios/lib/cancel/Cancel.js:13:27)
    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)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-config-ui-x/node_modules/axios/lib/axios.js:40:16)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
/usr/local/lib/node_modules/homebridge-config-ui-x/node_modules/axios/lib/cancel/Cancel.js:13
Cancel.prototype.toString = function toString() {

Homebridge Config:

    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config",
            "sudo": true
        },

Screenshots:

Environment:

diparrag commented 3 years ago

I have the same problem with the last update of HB UI on macOS Big Sur.

When the website was not responding I used commands on Terminal but it's not worked.

image

markcsegal commented 3 years ago

I too am seeing the same issue. Tried manually updating, and downgrading back to 4.33.0. That didn't help. Just for clarity its running on a Pi.

MrCoBalt commented 3 years ago

Same issue here:

homebridge@homebridge:~$ sudo hb-service logs
/usr/lib/node_modules/homebridge-config-ui-x/node_modules/axios/lib/cancel/Cancel.js:13
Cancel.prototype.toString = function toString() {
                          ^

TypeError: Cannot assign to read only property 'toString' of object '#<Cancel>'
    at Object.<anonymous> (/usr/lib/node_modules/homebridge-config-ui-x/node_modules/axios/lib/cancel/Cancel.js:13:27)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/lib/node_modules/homebridge-config-ui-x/node_modules/axios/lib/axios.js:40:16)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
johndshea commented 3 years ago

I am also seeing the same issue on both 4.34.0 and 4.33.0. I am running Windows 10.

jstncno commented 3 years ago

+1

$ sudo hb-service install --user homebridge                                                                       

/usr/local/lib/node_modules/homebridge-config-ui-x/node_modules/axios/lib/cancel/Cancel.js:13
Cancel.prototype.toString = function toString() {
                          ^

TypeError: Cannot assign to read only property 'toString' of object '#<Cancel>'
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-config-ui-x/node_modules/axios/lib/cancel/Cancel.js:13:27)
    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)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-config-ui-x/node_modules/axios/lib/axios.js:40:16)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
bearreth commented 3 years ago

Yes, I also tried downgrading to 4.33.0, all the way to 4.31.0, and that did not help. Also on macOS Catalina (not Big Sur yet).

stuartgibson commented 3 years ago

Same on both Big Sur and Rasperry Pi Zero

BossaGroove commented 3 years ago

Same on Big Sur, Rasperry Pi 3, Rasperry Pi 4 Same on nodejs 12.1, 12.10, 14.1, 14.15 Same on system nodejs and nvm nodejs

tml89 commented 3 years ago

Same on Raspberry PI Tried reinstall and downgrade

Zsoldier commented 3 years ago

Same on RPi 3. Also tried reinstall.

virtualserverguy commented 3 years ago

Same on Ubuntu. I have tried node.js back to 12.19.0 and same error.

MattCheetham commented 3 years ago

Same here on raspberry pi

Atothendrew commented 3 years ago

Same on a diskstation via Docker

shiienurm commented 3 years ago

Same here running on Raspberry Pi.

Environment: Node.js Version: v12.18.0 NPM Version: 6.14.5 Homebridge Config UI X Version: 4.34.0 Operating System: macOS Catalina 10.15.7 Homebridge Raspbian v1.0.6 Raspberry Pi 4 Model B Rev 1.4

henemm commented 3 years ago

Some here with the pre-built Raspberry Pi image.

TEEllis22 commented 3 years ago

Same issue on Windows 10. Node.js: v14.15.0 and v14.15.1 NPM Version: 6.14.5

johndshea commented 3 years ago

It appears to be an issue with axios (one of the dependencies) but I don't see any similar bug reported on axios's github page.

johndshea commented 3 years ago

I was able to fix it by explicitly uninstalling homebridge-config-ui and then doing a clean install of version 4.32.0.

npm uninstall -g homebridge-config-ui-x && npm install -g homebridge-config-ui-x@4.32.0

MattHardwick34 commented 3 years ago

Temp work around: I commented out (with // at the start) lines 13 and 14 and 15 of /usr/lib/node_modules/homebridge-config-ui-x/node_mod ules/axios/lib/cancel/Cancel.js

Atothendrew commented 3 years ago

I was able to fix it by explicitly uninstalling homebridge-config-ui and then doing a clean install of version 4.32.0.

npm uninstall -g homebridge-config-ui-x && npm install -g homebridge-config-ui-x@4.32.0

This fixed it for me as well!

root@:~# docker exec -it homebridge sh
/homebridge # npm uninstall -g homebridge-config-ui-x && npm install -g homebridge-config-ui-x@4.32.0

Now I can see the UI again. Thanks!

nikdata commented 3 years ago

@johndshea I was able to uninstall (I'm on a Raspberry Pi running Ubuntu), but the reinstall was a no go. Kept getting the following error message:

prebuild-install WARN install EACCES: permission denied, access '/root/.npm'
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/12.19.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/homebridge-config-ui-x/node_modules/node-pty-prebuilt-multiarch/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/homebridge-config-ui-x/node_modules/node-pty-prebuilt-multiarch/.node-gyp'
gyp ERR! System Linux 5.4.0-1022-raspi
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/homebridge-config-ui-x/node_modules/node-pty-prebuilt-multiarch
gyp ERR! node -v v12.19.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-pty-prebuilt-multiarch@0.9.0 install: `prebuild-install || node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-pty-prebuilt-multiarch@0.9.0 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!     /root/.npm/_logs/2020-11-25T21_03_22_123Z-debug.log

I am running the npm install command with sudo.

CodingKideon commented 3 years ago

Re-install isn't working for me either on macOS

nikdata commented 3 years ago

Tried running the install as root but still no luck.

bearreth commented 3 years ago

I was able to fix it by explicitly uninstalling homebridge-config-ui and then doing a clean install of version 4.32.0.

npm uninstall -g homebridge-config-ui-x && npm install -g homebridge-config-ui-x@4.32.0

This worked for me as well. macOS Catalina.

PlasmaSoftUK commented 3 years ago

@johndshea @nikdata

Add --unsafe to the end of the command worked for me

Plasma

CodingKideon commented 3 years ago

I updated NPM to the latest version and re-installed 4.32 back up and running!

diparrag commented 3 years ago

I was able to fix it by explicitly uninstalling homebridge-config-ui and then doing a clean install of version 4.32.0.

npm uninstall -g homebridge-config-ui-x && npm install -g homebridge-config-ui-x@4.32.0

Thank you, this work for me (macOS Big Sur).

image

nikdata commented 3 years ago

@PlasmaSoftUK so the --unsafe argument works!

When I log in to HomeBridge, I keep getting lots of errors in the log and at the top it shows "Homebridge not running".

Screen Shot 2020-11-25 at 3 31 39 PM

Error message in log:

Screen Shot 2020-11-25 at 3 32 32 PM
PlasmaSoftUK commented 3 years ago

@nikdata Since posting that I tried what @CodingKideon suggested, I updated NPM and then re-updated HomeBridgeUI all working ok now ..

sudo npm i npm@latest -g sudo npm install -g homebridge-config-ui-x

I'm now working fine at the latest version.

Plasma

oznu commented 3 years ago

This is a great thing to wake up to. Especially when the last update was done 6 days ago without issues...

It looks like something to do with the Axios dependency, as to why a downgrade to 4.32.0 works, I'm not sure, as no depedency versions have changed between 4.32.0 and 4.34.0.

I've locked in axios@0.19.2 in the test version. Can someone test to see if this is working?

sudo npm install -g --unsafe-perm homebridge-config-ui-x@test

If so I can quickly publish a release.

nikdata commented 3 years ago

Ok, I finally got it to work!

Here are the steps I followed to make it work (credit to the many fine folks in this issue):

  1. uninstall homebridge sudo npm uninstall -g homebridge-config-ui-x
  2. install latest version of npm sudo npm i npm@latest -g
  3. install homebridge (specific version): sudo npm install -g homebridge-config-ui-x@4.32.0 --unsafe

At this point, Homebridge UI was running and able to log in, but it still wasn't working (see my comment above).

  1. Uninstall all installed plugins
  2. Reinstall each plugin one at a time and restart homebridge after every plugin install

Thanks for all the help everyone.

oznu commented 3 years ago

https://github.com/oznu/homebridge-config-ui-x/issues/969#issuecomment-733965033

Can anyone confirm this works?

PlasmaSoftUK commented 3 years ago

@oznu All mine are now running the latest NPM and Node so are all functioning. If you want me to install it to just "test" it works, I can do that but I can't re-produce the old errors I was having as it now works.

Plasma

oznu commented 3 years ago

I can do that but I can't re-produce the old errors I was having as it now works.

Yes I could not reproduce them by the time I found out about this issue either.

Please try test anyway. I had set the "latest" tag back to 4.32.0 just in case.

MontroseSt commented 3 years ago

I followed the steps in https://github.com/oznu/homebridge-config-ui-x/issues/969#issuecomment-733966105 and I got home bridge up and running again. I also installed

sudo npm install -g --unsafe-perm homebridge-config-ui-x@test

However, I can not install any plugins, e.g. rachio

oznu commented 3 years ago

@MontroseSt

Just run sudo hb-service rebuild to fix the permissions on your node_modules folders. You should then be able to install plugins again.

MontroseSt commented 3 years ago

Thanks @oznu!

sudo hb-service rebuild

fixed it

Still getting a couple of warning, but those might be unrelated

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated text-encoding@0.6.4: no longer maintained
oznu commented 3 years ago

Still getting a couple of warning, but those might be unrelated

They're fine. Thanks for confirming it's working.

oznu commented 3 years ago

Setting 4.34.0 back to the "latest" tag.

Can those who downgraded to 4.32.0 please try upgrade back to 4.34.0?

I'm still not sure what caused this issue to occur (or to be resolved) without any changes on my end.

Ramias1 commented 3 years ago

Updated the plugin from within the 4.32.0 gui (on oznu/hombridge docker container) to 4.34.0. It restarted and seems to be working. None of the previous error messages in my logs.

oznu commented 3 years ago

Thank for @Ramias1 - that is a relief to know.

oznu commented 3 years ago

Just putting full instructions in:


This seems to be caused by an outage or issue elsewhere on the internet / npm registry - whatever it was seems to have been resolved now.

For those impacted please run the following commands to repair your installation:

macOS:

npm cache clean --force
sudo npm uninstall -g homebridge-config-ui-x
sudo npm install -g --unsafe-perm homebridge-config-ui-x@latest
sudo hb-service rebuild

Linux:

sudo npm cache clean --force
sudo npm uninstall -g homebridge-config-ui-x
sudo npm install -g --unsafe-perm homebridge-config-ui-x@latest

Windows:

npm cache clean --force
npm uninstall -g homebridge-config-ui-x
npm install -g --unsafe-perm homebridge-config-ui-x@latest
Ramias1 commented 3 years ago

This seems to be caused by an outage or issue elsewhere on the internet / npm registry - whatever it was seems to have been resolved now.

AWS us-east-1 had issues today. NPM could be using components there? Interesting that 4.32.0 was fine during this time but 4.33 was having issues.

I run this on my QNAP NAS in docker and there was a container station update (have had issues in the past) last night and a firmware update this morning so I didn't know what the cause was.

oznu commented 3 years ago

AWS us-east-1 had issues today. NPM could be using components there? Interesting that 4.32.0 was fine during this time but 4.33 was having issues.

Maybe. I still don't see how this caused the error reported though. Not knowing "why" this happened is very concerning to me - unfortunately it seemed to have been resolved by the time I woke up so was not able to reproduce.

markcsegal commented 3 years ago

Just putting full instructions in:

This seems to be caused by an outage or issue elsewhere on the internet / npm registry - whatever it was seems to have been resolved now.

For those impacted please run the following commands to repair your installation:

macOS:

npm cache clean --force
sudo npm uninstall -g homebridge-config-ui-x
sudo npm install -g --unsafe-perm homebridge-config-ui-x@latest
sudo hb-service rebuild

Linux:

sudo npm cache clean --force
sudo npm uninstall -g homebridge-config-ui-x
sudo npm install -g --unsafe-perm homebridge-config-ui-x@latest

Windows:

npm cache clean --force
npm uninstall -g homebridge-config-ui-x
npm install -g --unsafe-perm homebridge-config-ui-x@latest

This worked for me! had to reinstall some other plugins I might have updated at the same time.

M

nikdata commented 3 years ago

Everything's working good on my end too. I still haven't installed the Ring plugin - figured I'll wait for their services to come back online.

nicetranslady commented 3 years ago

Yep - the Ring cloud service was down right through yesterday afternoon. All works fine now. Very odd that it caused the errors thrown.

oznu commented 3 years ago

This was casued by the https://www.npmjs.com/package/systeminformation package pushing out an update that broke things. This broken release was quickly pulled by that module's author which is why the issue seemingly resolved itself.

The ring plugin also uses this depdency which is why users of that plugin experienced similar issues.

This was not releated to the AWS outage at the same time; the Homebridge UI works entirely offline if no internet connection is available.

I will lock down the version of this depdency in the next update so only fully tested versions of this dep get installed from now on (npm will automatically pull in patch releases of dependencies by default).

saltysmith1 commented 2 years ago

Looks like this has happened again tried to update to the latest ui and can no longer access homebridge