Timeular / noble-mac

Noble MacOS bindings using the official CoreBluetooth API
MIT License
94 stars 34 forks source link

cannot find module '../native/noble_mac' #37

Open slayer1021 opened 5 years ago

slayer1021 commented 5 years ago

Followed instructions for installation but keep getting the error cannot find module '../native/noble_mac' , did check the location and no file exists in the location.

kenken64 commented 4 years ago

Error: Cannot find module '../native/noble_mac'

geovie commented 4 years ago

@slayer1021 @kenken64 Which node version are you using? How are you installing noble-mac? You might want to take a look at abandonware/noble which has the bindings of this repo integrated.

blamay commented 3 years ago

I experienced this issue on both this repo & on abandonware/noble, and it was because I am using webpack which doesn't play nicely with the binding.node file, or in this repos case, the noble_mac.node file. I was able to fix it by forking the repo and using https://github.com/webpack-contrib/node-loader in binding.js

const NobleMac = require('node-loader!./native/binding.node').NobleMac;

I think there could potentially be a change to allow you to use node-loader in your project and pass the binding along as an option which starting noble.

geovie commented 3 years ago

@blamay Could you specify noble-mac as external in webpack, then it should work...

blamay commented 3 years ago

Specifying noble (or in my case, @abandonware/noble) as external does fix this problem for me.

ajjimsa commented 1 year ago

@blamay Possibly you don't have added in webpack file to load the .node extensions. ... resolve: { extensions: [".js", ".css",".node","..."], }, ...