noble-mac icon indicating copy to clipboard operation
noble-mac copied to clipboard

cannot find module '../native/noble_mac'

Open slayer1021 opened this issue 5 years ago • 6 comments

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.

slayer1021 avatar Sep 22 '19 02:09 slayer1021

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

kenken64 avatar Dec 20 '19 06:12 kenken64

@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.

geovie avatar Dec 20 '19 20:12 geovie

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.

blamay avatar Apr 12 '21 23:04 blamay

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

geovie avatar Apr 13 '21 07:04 geovie

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

blamay avatar May 04 '21 22:05 blamay

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

ajjimsa avatar Nov 23 '22 11:11 ajjimsa