Hello everyone,
After a few hours I need to ask. I am trying to install the -serialport- library in order to setup a testing & development Raspberry 3.
I have tried these two with no luck:
npm install serialport
sudo npm install serialport --unsafe-perm --build-from-source
After trying the second option, i get:
var port = new SerialPort('/dev/ttyUSB0', {
^
TypeError: SerialPort is not a function
at Object.<anonymous> (/home/pi/nodejs/ledslider/server.js:9:12)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:140:18)
at node.js:1043:3
I am trying to follow this simple example but getting the -serialport- is becoming a nightmare.
http://www.instructables.com/id/Easy-NodeJS-WebSockets-LED-Controller-for-Raspberr/ (http://www.instructables.com/id/Easy-NodeJS-WebSockets-LED-Controller-for-Raspberr/)
I believe the PiGateway uses the same library, thats how I know about it from before, maybe someone can help me out.
var serialport = require("serialport"); //https://github.com/voodootikigod/node-serialport
thank you a lot, I have run out of ideas.
See how I use serialport in gateway.js (https://github.com/LowPowerLab/RaspberryPi-Gateway/blob/master/gateway.js).