ebaauw / homebridge-hue

Homebridge plugin for Philips Hue
Apache License 2.0
898 stars 91 forks source link

Failed upgrade to 0.13.27 #1040

Closed garetheowen closed 2 years ago

garetheowen commented 2 years ago

Issue

Tried to update to latest version 0.13.26 -> 0.13.27. Upgraded dependent Node.js first. v16.13.0 Update failed. Message as below.

Log Messages

USER: pi DIR: /usr/local CMD: sudo -E -n npm install -g homebridge-hue@latest

TypeError: Class extends value undefined is not a constructor or null at Object. (/usr/local/lib/node_modules/npm/node_modules/socks-proxy-agent/dist/agent.js:114:44) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (/usr/local/lib/node_modules/npm/node_modules/socks-proxy-agent/dist/index.js:5:33) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (/usr/local/lib/node_modules/npm/node_modules/make-fetch-happen/lib/agent.js:161:25) at Module._compile (node:internal/modules/cjs/loader:1101:14)

Command failed. Please review log for details.

Debug Files

NeoRame commented 2 years ago

same here

keness521 commented 2 years ago

Ditto

ebaauw commented 2 years ago

I think this is an error with an old version of npm that fails under NodeJS v16. Can you (re-)install npm or does that show a similar error? I’m afraid the workaround is to downgrade NodeJS, update npm, update NodeJS. See https://github.com/homebridge/homebridge/issues/3002#issuecomment-955994607

keness521 commented 2 years ago

Hmm, beyond my abilities. I’ll have to wait until someone else confirms or a way to update through the normal tools arrives.

Edit: The post you link to has a very clear step-by-step for how to downgrade NodeJS, upgrade npm, then re-upgrade NodeJS, then upgrade npm (again).

Is that what is needed here? It looks pretty easy and straightforward, but I think I’ll wait until someone more experienced than me confirms.

Edit2: Ok, I didn’t wait. I followed those instructions, and once completed, successfully upgraded homebridge-hue, and everything is working smoothly.

garetheowen commented 2 years ago

Tried to do the downgrade of node and upgrade of npm without instructions (didn't see the link). Ended up somehow removing npm completely. Had to reinstall my homebridge image from scratch and then restore the config. Now working. From what I saw whilst trying to do this, I would concur with your assessment. Even just running npm -V with latest node.js was giving me the same error until I downgraded node.js to 16.1.0. When I managed to get npm -V to run, it did show me that I was on a 7.X version.

tomrush commented 2 years ago

I think this is an error with an old version of npm that fails under NodeJS v16. Can you (re-)install npm or does that show a similar error? I’m afraid the workaround is to downgrade NodeJS, update npm, update NodeJS. See homebridge/homebridge#3002 (comment)

I can confirm that following the steps in the link work and resolve the update issue.