question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Class extends value undefined is not a constructor or null

See original GitHub issue

Describe The Bug:

Using hb-service to update node to v16.13.0 fails at the rebuilding stage. See below logs. Error also presents itself when then restarting Homebridge each time, but doesn’t actually seem to affect Homebridge functionality. Using the command to downgrade node back to 14.18.1 runs and rebuilds successfully, removing all errors.

To Reproduce:

Running in terminal:

sudo hb-service update-node 16.13.0

Logs

When running the command to update node:

pi@homebridge:~ $ sudo hb-service update-node 16.13.0
ℹ Installing Node.js v16.13.0 over v14.18.1...
ℹ Target: /usr/local
✔ Download complete.
✔ Installed Node.js v16.13.0
ℹ Rebuilding for Node.js v16.13.0...
TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/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.<anonymous> (/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.<anonymous> (/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)
TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/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.<anonymous> (/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.<anonymous> (/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)
Error: Command failed: npm rebuild --unsafe-perm
✖ ERROR: Failed Operation
ℹ Restarting Homebridge Service...
✔ Homebridge Restarted
pi@homebridge:~ $ 

From then restarting Homebridge each time:

[27/10/2021, 09:34:39] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[27/10/2021, 09:34:44] [HB Supervisor] Restarting Homebridge...
[27/10/2021, 09:34:44] [HB Supervisor] Starting Homebridge with extra flags: -I -D
[27/10/2021, 09:34:45] [HB Supervisor] Started Homebridge v1.3.6-beta.1 with PID: 10554
Initializing HAP-NodeJS v0.9.6...
[27/10/2021, 09:34:46] Loaded config.json with 0 accessories and 8 platforms.
[27/10/2021, 09:34:46] Loaded 0 cached accessories from cachedAccessories.
[27/10/2021, 09:34:46] ---
TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/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.<anonymous> (/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.<anonymous> (/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)
[27/10/2021, 09:34:47] Loaded plugin: homebridge-config-ui-x@4.41.3-test.2
[27/10/2021, 09:34:47] Registering platform 'homebridge-config-ui-x.config'
[27/10/2021, 09:34:47] ---

Environment:

  • Node.js Version: 14.18.1 -> 16.13.0
  • NPM Version: 6.14.15 -> 8.1.0
  • Homebridge Version: 1.3.6-beta.1
  • Operating System: Raspbian (HB Image)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:34 (2 by maintainers)

github_iconTop GitHub Comments

30reactions
bwp91commented, Dec 14, 2021

Thanks to @sw33tT and @SeydX for your fixes. I will rewrite here what seems to be working for most users (seydx solution):

  1. Downgrade node to 14.18.1
    sudo hb-service update-node 14.18.1
    
  2. Update npm to the latest version 8
    sudo npm i -g npm
    
  3. Update node to 16.13.1
    sudo hb-service update-node 16.13.1
    
  4. Re-update npm to the latest version 8
    sudo npm i -g npm
    
1reaction
bwp91commented, Nov 2, 2021

@christiantschoerner for future reference you should avoid using odd (as opposed to even) version numbers of node as they aren’t supported by homebridge. doesn’t mean it won’t work… but it’s not recommended

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class extends value undefined is not a function or null - ...
I am getting the following error when trying to create these entities. TypeError: Class extends value undefined is ...
Read more >
Class extends value undefined is not a constructor or null ...
TypeError: Class extends value undefined is not a constructor or null in @aws-sdk/client-cloudwatch-events #3389 ; bug This issue is a bug.
Read more >
Class extends value undefined is not a constructor or null ...
Initial searching seems to imply that this indicates an issue with a circular dependency. Might have to be a separate issue, but there...
Read more >
class extends value undefined is not a constructor or null ...
TypeError : Class extends value undefined is not a function or null. Start > Run > AppWiz.cpl > Uninstall node.js. Delete the node...
Read more >
TypeError: Class extends value undefined is not ...
[moved to issue] Tutorial problem: TypeError: Class extends value undefined is not a constructor or null - Get Help and Help Others -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found