Node.js 在我的角度项目上使用节点蓝牙有困难。错误:错误类型错误:bluetooth.DeviceINQ不是构造函数
我是一个新手,有Node.js 在我的角度项目上使用节点蓝牙有困难。错误:错误类型错误:bluetooth.DeviceINQ不是构造函数,node.js,angular,bluetooth,Node.js,Angular,Bluetooth,我是一个新手,有angular,typescript,nodejs。我目前正在尝试使用节点蓝牙。是否可以使用此软件包检测蓝牙设备(如移动设备) 这是我的示例代码 ngOnInit(): void { const bluetooth = require('node-bluetooth'); // create bluetooth device instance const device = new bluetooth.DeviceINQ(); device .on('f
angular
,typescript
,nodejs
。我目前正在尝试使用节点蓝牙
。是否可以使用此软件包检测蓝牙设备(如移动设备)
这是我的示例代码
ngOnInit(): void {
const bluetooth = require('node-bluetooth');
// create bluetooth device instance
const device = new bluetooth.DeviceINQ();
device
.on('finished', console.log.bind(console, 'finished'))
.on('found', function found(address, name){
console.log('Found: ' + address + ' with name ' + name);
}).scan();
不幸的是,在const device=new bluetooth.DeviceINQ()上代码>它遇到错误:
错误类型错误:bluetooth.DeviceINQ不是构造函数
我如何使用它?我是否需要像其他人一样导入它并将其放在构造函数中