Warm tip: This article is reproduced from serverfault.com, please click

reactjs-节点JS模块不起作用。

(reactjs - Node JS Module Not Working . Module Not Found)

发布于 2020-07-22 14:45:55

我正尝试在文档中使用名为systeminformation的npmjs模块,因为下面提供了该模块,但可以使用它,但它给了我一个未找到的错误模块

文档中的代码:

const si = require('systeminformation');

 si.cpu()
   .then(data => console.log(data))
   .catch(error => console.error(error));

我的代码:

const si = require('systeminformation');

comp=()=>{
    si.cpu()
        .then(data => console.log(data))
        .catch(error => console.error(error));
    }

请帮助我,我尝试重新安装节点模块npm i systeminformation

该NpmJS模块- https://www.npmjs.com/package/systeminformation

Questioner
Belgin Android
Viewed
0
PDHide 2020-11-28 17:01:02

安装加密货币:

Npm install -i crypto

这会将缺少的模块安装到本地节点模块