itag-mqtt-bridge icon indicating copy to clipboard operation
itag-mqtt-bridge copied to clipboard

Can't run 'yarn start'

Open nickdos opened this issue 7 years ago • 1 comments

I installed yarn, copied repo to my device (RPi) and ran sudo yarn install, which seemed to run successfully. When I then ran yarn start inside the project directory, I got the following errors:

pi@homebridge-pi:~/itag-mqtt-bridge-master $ yarn start
yarn run v1.7.0
$ node index.js
internal/modules/cjs/loader.js:550
    throw err;
    ^

Error: Cannot find module '/home/pi/itag-mqtt-bridge-master/index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
    at Function.Module._load (internal/modules/cjs/loader.js:475:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I checked package.json and it has the correct main line, so not sure why its trying to load index.js in the project directory and not out of src.

EDIT 2: I've found quite a few posts from people trying to use the builit-in BT radio on the RPi and also using Wifi. This seems to be a problem where the turning off the wifi fixes the issue. In my case I'm using RPi zero W (no ethernet) so am using wifi.

nickdos avatar Jun 20 '18 06:06 nickdos

I got it to work by editing package.json as follows:

"start": "node src/index.js"

But I now see the following output:

debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE discovered id: 0cafd1f10677 localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE discovered id: 75b12f6638ff localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE discovered id: 0cafd1f10677 localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE discovered id: b8e8562a70bb localName: undefined state: disconnected
debug: NOBLE discovered id: 75b12f6638ff localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected

no sign of an 'iTag' local name. I've tried with it both connected and not connected to my phone.

Any suggestions?

EDIT: I changed line 126 to be "iTag" as it appeared on my phone and re-ran. While it was running I saw the same output but turned device on and off a few times and then saw this in output:

debug: NOBLE discovered id: c22c06045205 localName: iTag state: disconnected
info: NOBLE peripheral id: c22c06045205 connecting
debug: NOBLE discovered id: 75b12f6638ff localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE peripheral id: c22c06045205 connected
info: NOBLE scanning stopped
warn: NOBLE peripheral id: c22c06045205 disconnected
info: NOBLE scanning started
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected
debug: NOBLE discovered id: 6926118d202f localName: undefined state: disconnected
debug: NOBLE discovered id: 1564c6ff1764 localName: undefined state: disconnected

So it connected and disconnected again. I can make this message appear if I press the button on the device but it stays in discovery mode with the blue LED flashing the whole time.

nickdos avatar Jun 20 '18 06:06 nickdos