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: os.version is not a function

See original GitHub issue

Describe the bug Looks like there’s some js error thrown upon startup on the Raspberry Pi Zero W TypeError: os.version is not a function

To reproduce Followed Pi Zero W tutorial with minimal yaml config below.

Relevant logs

*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
2/6/2021, 2:29:20 PM - info - IntegrationsModule: Loading integrations: home-assistant, bluetooth-low-energy
(node:3360) DeprecationWarning: You are using a version of Node.js that will reach EOL in April 2021. The support for this version will be dropped in 7.13. Please refer to https://ela.st/nodejs-support for additional information.
2/6/2021, 2:29:26 PM - info - NestFactory: Starting Nest application...
2/6/2021, 2:29:27 PM - info - InstanceLoader: AppModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: ConfigModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: NestEmitterModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: IntegrationsModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: HttpModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: DiscoveryModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: PrometheusModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: ClusterModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: TerminusModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: BluetoothModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: ScheduleModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: EntitiesModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: BluetoothLowEnergyModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: HomeAssistantModule dependencies initialized
2/6/2021, 2:29:27 PM - info - InstanceLoader: StatusModule dependencies initialized
2/6/2021, 2:29:31 PM - info - RoutesResolver: EntitiesController {/entities}:
2/6/2021, 2:29:31 PM - info - RouterExplorer: Mapped {/entities, GET} route
2/6/2021, 2:29:31 PM - info - RoutesResolver: StatusController {/status}:
2/6/2021, 2:29:31 PM - info - RouterExplorer: Mapped {/status, GET} route
2/6/2021, 2:29:31 PM - info - RoutesResolver: PrometheusController {/metrics}:
2/6/2021, 2:29:31 PM - info - RouterExplorer: Mapped {/metrics, GET} route
2/6/2021, 2:29:31 PM - warn - BluetoothLowEnergyService: The allowlist and denylist are empty, no sensors will be created! Please add some of the discovered IDs below to your configuration.
/opt/nodejs/lib/node_modules/room-assistant/node_modules/systeminformation/lib/system.js:124
          if (!result.virtual && os.version().toLowerCase().indexOf('microsoft') >= 0) {
                                    ^

TypeError: os.version is not a function
    at /opt/nodejs/lib/node_modules/room-assistant/node_modules/systeminformation/lib/system.js:124:37
    at ChildProcess.exithandler (child_process.js:285:7)
    at ChildProcess.emit (events.js:189:13)
    at maybeClose (internal/child_process.js:978:16)
    at Socket.stream.socket.on (internal/child_process.js:395:11)
    at Socket.emit (events.js:189:13)
    at Pipe._handle.close (net.js:610:12)

Relevant configuration

global:
  integrations:
    - homeAssistant
    - bluetoothLowEnergy
homeAssistant:
  mqttUrl: 'mqtt://192.168.1.10:1883'
  mqttOptions:
    username: someUsername
    password: somePassword
bluetoothLowEnergy:
  timeout: 10
  maxDistance: 5

Expected behavior When starting room-assistant it should run

Environment

  • room-assistant version: 2.13.0
  • installation type: NodeJS @ v11.5.0 (npm @ 6.4.1)
  • hardware: Raspberry Pi Zero W
  • OS: Raspbian (Linux raspberry 5.10.11+ #1399)

Additional context Followed instructions from tutorial https://www.room-assistant.io/guide/quickstart-pi-zero-w.html#installing-room-assistant

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Erelen-Laiquendicommented, Feb 8, 2021

Yes, with v14.13 it works. Thanks! New issue: https://github.com/mKeRix/room-assistant/issues/514

0reactions
mKeRixcommented, Feb 13, 2021

I’ve updated the Pi Zero W installation guide to use the current LTS version of NodeJS now, which is 14.x. Huge thanks to @SamKirsch10 - I forked your script and only made some small adjustments to change it from the latest to LTS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js's "os" module does not have the userInfo() method
Specifically, I get the type error "os.userinfo is not a function" when I try to use a file that is using that method....
Read more >
Node.js | os.version() Method - GeeksforGeeks
The os.version() method is used to identify the version of the kernel of the Operating System. This information is determined by calling uname ......
Read more >
TypeError: Object.fromEntries is not a function - Microsoft Learn
TypeError : Object.fromEntries is not a function. I am trying to setup my dev environment for SPFx development.
Read more >
ua-parser-js - npm
The user-agent string must be passed in nodejs for the function to work ... getOS() - returns the running operating system name and...
Read more >
TypeError: "x" is not a function - JavaScript - MDN Web Docs
Maybe there is a typo in the function name? Maybe the object you are calling the method on does not have this function?...
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 Reddit Thread

No results found

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