DylanPiercey / local-devices

🔮 Find devices connected to the current local network.
MIT License
139 stars 27 forks source link

cp.exec is not a function #33

Closed MrPickles2009 closed 3 years ago

MrPickles2009 commented 3 years ago

I just tried bringing this package into my Vue 2 app and received the following error:

Uncaught TypeError: cp.exec is not a function        node_modules/local-devices/src/index.js:85

I was using it like such:

import find from 'local-devices';

export default {
    ...
    data () {
        return {
            devices: []
        }
    },
    mounted () {
        this.findDevicesOnNetwork();
    },
    methods: {
        findDevicesOnNetwork () {
            find().then(devices => {
                this.devices = devices;
                console.log(devices);
            });
        },
    }
    ...
}

Any idea how to fix?

DylanPiercey commented 3 years ago

@MrPickles2009 this module only works in node js, it will not work when loaded in the browser via webpack or any bundler.