2

I am working on a project where I want to access and display the temperature of my CPU. I found a tutorial where I via the "systeminformation" package can gain access to mutliple CPU stats. But when I use the cpuTemperature function it does not return the temperature, instead it returns "-1" and empty list and "-1".

si.cpuTemperature(function(data) {
  console.log('CPU-Temperature:');
  console.log(data);
});

=> { main: -1, cores: [], max: -1 }

Am I doing something wrong or is my CPU not supporting this type of event?

Tutorial I have used: https://github.com/sebhildebrandt/systeminformation

4

1 回答 1

3

我想你是在 Windows 上尝试的。根据文档,如果您没有获得任何数据,您需要以管理员权限运行 wmic。对于 OSX 和 Linux,您还需要安装一些额外的软件包,例如 OSX 的 osx-temperature-sensor 节点模块,以及传感器软件包(基于 Debian 的 lm-sensors)Linux 机器。您可以尝试从管理员终端运行节点以检查 Windows 上的权限问题。

于 2017-11-08T13:54:17.167 回答