Skip to content

TypeError: speeds[i].toFixed is not a function in getCpuCurrentSpeedSync() #976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
BolverBlitz opened this issue Mar 7, 2025 · 1 comment

Comments

@BolverBlitz
Copy link

Describe the bug
Crashes application when running in docker on alpine

To Reproduce
Steps to reproduce the behavior:

  1. used getCpuCurrentSpeedSync()

Current Output
/app/node_modules/systeminformation/lib/cpu.js:1017
cores.push(parseFloat(speeds[i].toFixed(2)));
^

TypeError: speeds[i].toFixed is not a function
at getCpuCurrentSpeedSync (/app/node_modules/systeminformation/lib/cpu.js:1017:39)
at /app/node_modules/systeminformation/lib/cpu.js:748:31
at ChildProcess.exithandler (node:child_process:414:7)
at ChildProcess.emit (node:events:518:28)
at maybeClose (node:internal/child_process:1104:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5)

Expected behavior
To not crash

Environment (please complete the following information):

  • systeminformation package version: 5.25.11
  • OS: node:20-alpine
  • Hardware: ARM CPU on in KVM VM inside Docker

To get all needed environment information, please run the following command:

 ┌─────────────────────────────────────────────────────────────────────────────────────────┐
│  SYSTEMINFORMATION                                                     Version: 5.25.11 │
└─────────────────────────────────────────────────────────────────────────────────────────┘

Operating System:
──────────────────────────────────────────────────────────────────────────────────────────
Platform         : linux
Distro           : Alpine Linux
Release          : v3.21
Codename         :
Kernel           : 6.1.0-31-arm64
Arch             : arm64
Hostname         : 8d825dc408a5
Codepage         : UTF-8
Build            :

System:
──────────────────────────────────────────────────────────────────────────────────────────
Manufacturer     : netcup
Model            : Docker Container
Version          : VPS 1000 ARM G11
Virtual          :

CPU:
──────────────────────────────────────────────────────────────────────────────────────────
Manufacturer     : Neoverse-N1
Brand            :
Family           :
Model            :
Stepping         :
Speed            :
Cores            : 6
PhysicalCores    : 6
PerformanceCores : 6
EfficiencyCores  :
Processors       : 1
Socket           :

Additional context
The function runs cat /proc/cpuinfo | grep "cpu MHz" | cut -d " " -f 3
This outputs nothing, so here is just the /proc/cpuinfo output

cat /proc/cpuinfo
processor       : 0
BogoMIPS        : 50.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x3
CPU part        : 0xd0c
CPU revision    : 1

processor       : 1
BogoMIPS        : 50.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x3
CPU part        : 0xd0c
CPU revision    : 1

processor       : 2
BogoMIPS        : 50.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x3
CPU part        : 0xd0c
CPU revision    : 1

processor       : 3
BogoMIPS        : 50.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x3
CPU part        : 0xd0c
CPU revision    : 1

processor       : 4
BogoMIPS        : 50.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x3
CPU part        : 0xd0c
CPU revision    : 1

processor       : 5
BogoMIPS        : 50.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x3
CPU part        : 0xd0c
CPU revision    : 1
@lyca-knight
Copy link

I have the same Problem on Arch Linux (not in a Docker)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants