It’s been a while since I did a fresh install so I don’t remember if the node version matters. I’m surprised you’re still getting a 5.0.0 error if you deleted the version from your package.json. Try running:
npm install serialport
from the command line. Then, from the folder where your package.json is saved, run:
Me too! And it was quite difficult then. I had ZERO knowledge of Raspberry Pi at that time. Now I cannot remember how I did it. Here we go…
pi@raspberrypi:~/Downloads/smartthings-nodeproxy $ npm install serialport
npm WARN deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
pi@raspberrypi:~/Downloads/smartthings-nodeproxy sudo apt update
Hit:1 https://deb.nodesource.com/node_6.x buster InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:3 http://archive.raspberrypi.org/debian buster InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
pi@raspberrypi:~/Downloads/smartthings-nodeproxy sudo apt full-upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
The following packages were automatically installed and are no longer required:
libc-ares2 libnode64 libuv1 nodejs-doc
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi:~/Downloads/smartthings-nodeproxy $
SyntaxError: Unexpected token …
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions…js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object. (/home/pi/Downloads/smartthings-nodeproxy/node_modules/serialport/lib/index.js:1:82)
Was working well 2 hours ago. Unplugged the RPi. Ate dinner. Plugged it back in. Now it won’t do anything but turn the speaker on/off. Nothing else. It was throwing this error before and was working. Not working now. Any thoughts?
pi@raspberrypi:~/Downloads/smartthings-nodeproxy $ node server.js
[2020-03-30T01:20:28.750Z] [stnp] SmartThings Node Proxy listening at http://:::8082
[2020-03-30T01:20:28.880Z] [stnp] Loaded plugin: rnet
(node:1226) UnhandledPromiseRejectionWarning: TypeError: SerialPort.list no longer takes a callback and only returns a promise
at Function.SerialPort.list (/home/pi/Downloads/smartthings-nodeproxy/node_modules/@serialport/stream/lib/index.js:651:11)
at getSerialPorts (/home/pi/Downloads/smartthings-nodeproxy/plugins/rnet.js:401:16)
at Rnet.init (/home/pi/Downloads/smartthings-nodeproxy/plugins/rnet.js:147:5)
at Object. (/home/pi/Downloads/smartthings-nodeproxy/plugins/rnet.js:131:6)
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)
(node:1226) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1226) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[2020-03-30T01:20:28.892Z] [rnet] Connected to RNET: /dev/ttyUSB0