delian / node-unifiapi

UniFi API ported to Node.JS
GNU General Public License v3.0
49 stars 19 forks source link

Not Working on RPI #18

Closed Gigaclank closed 5 years ago

Gigaclank commented 5 years ago

I am trying to use this on a raspberry pi so that i can 'with the push of a button' create a voucher - this is solely experimental at the minute. Is there any known reason to why this wouldn't work or cant work? i have attached a the snippet error i get when trying to run this.

/home/pi/node_modules/node-unifiapi/index.js:1
(function (exports, require, module, __filename, __dirname) { let debug = require('debug')('UnifiAPI');
                                                                                          ^

TypeError: require(...) is not a function
    at Object.<anonymous> (/home/pi/node_modules/node-unifiapi/index.js:1:91)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/pi/nodetest/buttonpress.js:1:75)
    at Module._compile (module.js:653:30)
delian commented 5 years ago

Not sure, it appears, that the module is executed in a scope, where the require function is not defined. I don't really have an idea how this could happen (it is executed in node, right? In any node scope there is a required predefined...)