ime011
Posts: 4
Joined: Mon Dec 02, 2019 7:55 pm

I am trying to run sudo node app.js, but i get an error

Thu Dec 05, 2019 3:40 am

Hi,

I installed node.js and npm and I am trying to run sudo node app.js, but i get the error in the img posted.

I was thinking that my Javascript has errors. Also may be NODE, NPM or Root. I am not sure, Please assist in helping me figure out this issue.

My app.js file contains the this code:

const Noble = require("noble"); const BeaconScanner = require("node-beacon-scanner");
var scanner = new BeaconScanner();
scanner.onadvertisement = (advertisement) => { var beacon = advertisement["iBeacon"]; beacon.rssi = advertisement["rssi"]; console.log(JSON.stringify(beacon, null, " ")) };
scanner.startScan().then(() => { console.log("Scanning for BLE devices...") ; }).catch((error) => { console.error(error); });

I am referring to this project: https://www.thepolyglotdeveloper.com/20 ... 4023965747

Source: https://blog.truthlabs.com/beacon-track ... 4afa880318
Attachments
cap44.JPG
cap44.JPG (35.35 KiB) Viewed 218 times

mattmiller
Posts: 2230
Joined: Thu Feb 05, 2015 11:25 pm

Re: node.js

Thu Dec 05, 2019 8:27 am

I just tried running npm install noble --save on my Pi4 and it came up with a load of errors relating to bluetooth-hci-socket

Looking at the project link, other people say it didn't work a year ago either

So it probably an old project that used to work with earlier versions of Raspbian/node and the modules haven't been maintained to keep up with developments

ime011
Posts: 4
Joined: Mon Dec 02, 2019 7:55 pm

Re: I am trying to run sudo node app.js, but i get an error

Thu Dec 05, 2019 3:18 pm

Would it be possible to downgrade to the previous version.

Return to “Troubleshooting”