Closed SaschaSp closed 7 years ago
Could you please try to change it from ttyACM to ttyUSB in https://github.com/thobach/MMM-Gestures/blob/master/Node.js/gestures.js#L102 and restart the gesture module via pm2 afterwards?
Hello Thomas, thanks for the fast respond. Maybe there are more Steps not working.
First when i follow point 2 from the Installation manual (Install dependencies via: npm install serialport nodejs-websocket i have follow result:
pi@mmm:~/MagicMirror/modules/MMM-Gestures $ npm install serialport nodejs-websocket /home/pi/MagicMirror/modules └── nodejs-websocket@1.7.1
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/package.json' npm WARN enoent ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/node_modules/node_helper/package.json' npm WARN modules No description npm WARN modules No repository field. npm WARN modules No README data npm WARN modules No license field. npm ERR! Linux 4.9.37-v7+ npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "serialport" "nodejs-websocket" npm ERR! node v6.11.1 npm ERR! npm v3.10.10 npm ERR! path /home/pi/MagicMirror/modules/node_modules/serialport/build/Makefile npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall unlink
npm ERR! Error: EACCES: permission denied, unlink '/home/pi/MagicMirror/modules/node_modules/serialport/build/Makefile' npm ERR! at Error (native) npm ERR! { Error: EACCES: permission denied, unlink '/home/pi/MagicMirror/modules/node_modules/serialport/build/Makefile' npm ERR! at Error (native) npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'unlink', npm ERR! path: '/home/pi/MagicMirror/modules/node_modules/serialport/build/Makefile' } npm ERR! npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request: npm ERR! /home/pi/MagicMirror/modules/MMM-Gestures/npm-debug.log
The second thing is i change gestures.js located (pi@mmm:~/MagicMirror/modules/MMM-Gestures/Node.js $) to
// init node.js app function init() {
// make system call to get device where Arduino is connected (e.g. /dev/ttyACM0)
// can vary depending on which USB port the Arduino is connected
var exec = require('child_process').exec;
exec('ls /dev/ttyUSB', function(error, stdout, stderr) {
after Safe, pm2 restart gestures
The pm2 log gestures displays: [TAILING] Tailing last 15 lines for [gestures] process (change the value with --lines option) /home/pi/.pm2/logs/gestures-out-1.log last 15 lines: 1|gestures | Thu Jul 20 2017 01:10:44 GMT+0200 (CEST): exec error: Error: Command failed: ls /dev/ttyACM 1|gestures | ls: Zugriff auf /dev/ttyACM nicht möglich: Datei oder Verzeichnis nicht gefunden 1|gestures | 1|gestures | Thu Jul 20 2017 01:15:22 GMT+0200 (CEST): exec error: Error: Command failed: ls /dev/ttyACM 1|gestures | ls: Zugriff auf /dev/ttyACM nicht möglich: Datei oder Verzeichnis nicht gefunden 1|gestures | 1|gestures | New connection from client established 1|gestures | Received MMM-Gestures client registered to WebSocket server 1|gestures | Connection closed 1|gestures | Thu Jul 20 2017 02:24:58 GMT+0200 (CEST): exec error: Error: Command failed: ls /dev/ttyACM 1|gestures | ls: Zugriff auf /dev/ttyACM nicht möglich: Datei oder Verzeichnis nicht gefunden 1|gestures |
/home/pi/.pm2/logs/gestures-error-1.log last 15 lines:
1|gestures | module.js:471
1|gestures | throw err;
1|gestures | ^
1|gestures |
1|gestures | Error: Cannot find module 'serialport'
1|gestures | at Function.Module._resolveFilename (module.js:469:15)
1|gestures | at Function.Module._load (module.js:417:25)
1|gestures | at Module.require (module.js:497:17)
1|gestures | at require (internal/module.js:20:19)
1|gestures | at Object.
Thank you for your time and help.
Little Update
pi@mmm:~ $ pm2 log gestures [TAILING] Tailing last 15 lines for [gestures] process (change the value with --lines option) /home/pi/.pm2/logs/gestures-out-1.log last 15 lines: 1|gestures | Sat Jul 22 2017 14:48:20 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:21 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:22 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:23 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:24 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:26 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:27 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:29 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:30 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:31 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:32 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:33 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:34 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:36 GMT+0200 (CEST): Using USB: /dev/ttyUSB0. 1|gestures | Sat Jul 22 2017 14:48:37 GMT+0200 (CEST): Using USB: /dev/ttyUSB0.
/home/pi/.pm2/logs/gestures-error-1.log last 15 lines:
1|gestures | at Pipe._handle.close [as _onclose] (net.js:497:12)
1|gestures | /home/pi/MagicMirror/modules/MMM-Gestures/Node.js/gestures.js:117
1|gestures | parser: serialport.parsers.readline("\n")
1|gestures | ^
1|gestures |
1|gestures | TypeError: serialport.parsers.readline is not a function
1|gestures | at /home/pi/MagicMirror/modules/MMM-Gestures/Node.js/gestures.js:117:33
1|gestures | at ChildProcess.exithandler (child_process.js:195:7)
1|gestures | at emitTwo (events.js:106:13)
1|gestures | at ChildProcess.emit (events.js:191:7)
1|gestures | at maybeClose (internal/child_process.js:891:16)
1|gestures | at Socket.
Thanks for the update, how did you manage to install serialport and nodejs-websocket? Did you just do it with "sudo " prepended? I would like to update the readme file.
Regarding your error TypeError: serialport.parsers.readline is not a function
, did you use version 4 of serialport? You can find this out by running npm list
or npm list -g
. It seems in version 5 the API changed (v4: https://github.com/EmergingTechnologyAdvisors/node-serialport/blob/4.0.7/README.md#parsers vs. v5: https://github.com/EmergingTechnologyAdvisors/node-serialport/blob/5.0.0-beta8/README.md#module_serialport--SerialPort.parsers).
My first try was to npm install serialport and nodejs-websocket in the folder /home/pi/MagicMirror/modules/MMM-Gestures because your manual say under Installation 1. navigate into the new folder. My second try was without using sudo to install both into the folder /home/pi/node_modules/
npm list: serialport@5.0.0-beta8 nodejs-websocket@1.7.1
Here the complete list:
pi@mmm:~/node_modules $ npm list /home/pi ├── nodejs-websocket@1.7.1 ├─┬ serialport@5.0.0-beta8 │ ├── bindings@1.2.1 │ ├── commander@2.11.0 │ ├─┬ debug@2.6.8 │ │ └── ms@2.0.0 │ ├── nan@2.6.2 │ ├─┬ node-pre-gyp@0.6.36 │ │ ├─┬ mkdirp@0.5.1 │ │ │ └── minimist@0.0.8 │ │ ├─┬ nopt@4.0.1 │ │ │ ├── abbrev@1.1.0 │ │ │ └─┬ osenv@0.1.4 │ │ │ ├── os-homedir@1.0.2 │ │ │ └── os-tmpdir@1.0.2 │ │ ├─┬ npmlog@4.1.2 │ │ │ ├─┬ are-we-there-yet@1.1.4 │ │ │ │ └── delegates@1.0.0 │ │ │ ├── console-control-strings@1.1.0 │ │ │ ├─┬ gauge@2.7.4 │ │ │ │ ├── aproba@1.1.2 │ │ │ │ ├── has-unicode@2.0.1 │ │ │ │ ├── object-assign@4.1.1 │ │ │ │ ├── signal-exit@3.0.2 │ │ │ │ ├─┬ string-width@1.0.2 │ │ │ │ │ ├── code-point-at@1.1.0 │ │ │ │ │ └─┬ is-fullwidth-code-point@1.0.0 │ │ │ │ │ └── number-is-nan@1.0.1 │ │ │ │ ├─┬ strip-ansi@3.0.1 │ │ │ │ │ └── ansi-regex@2.1.1 │ │ │ │ └── wide-align@1.1.2 │ │ │ └── set-blocking@2.0.0 │ │ ├─┬ rc@1.2.1 │ │ │ ├── deep-extend@0.4.2 │ │ │ ├── ini@1.3.4 │ │ │ ├── minimist@1.2.0 │ │ │ └── strip-json-comments@2.0.1 │ │ ├─┬ request@2.81.0 │ │ │ ├── aws-sign2@0.6.0 │ │ │ ├── aws4@1.6.0 │ │ │ ├── caseless@0.12.0 │ │ │ ├─┬ combined-stream@1.0.5 │ │ │ │ └── delayed-stream@1.0.0 │ │ │ ├── extend@3.0.1 │ │ │ ├── forever-agent@0.6.1 │ │ │ ├─┬ form-data@2.1.4 │ │ │ │ └── asynckit@0.4.0 │ │ │ ├─┬ har-validator@4.2.1 │ │ │ │ ├─┬ ajv@4.11.8 │ │ │ │ │ ├── co@4.6.0 │ │ │ │ │ └─┬ json-stable-stringify@1.0.1 │ │ │ │ │ └── jsonify@0.0.0 │ │ │ │ └── har-schema@1.0.5 │ │ │ ├─┬ hawk@3.1.3 │ │ │ │ ├── boom@2.10.1 │ │ │ │ ├── cryptiles@2.0.5 │ │ │ │ ├── hoek@2.16.3 │ │ │ │ └── sntp@1.0.9 │ │ │ ├─┬ http-signature@1.1.1 │ │ │ │ ├── assert-plus@0.2.0 │ │ │ │ ├─┬ jsprim@1.4.0 │ │ │ │ │ ├── assert-plus@1.0.0 │ │ │ │ │ ├── extsprintf@1.0.2 │ │ │ │ │ ├── json-schema@0.2.3 │ │ │ │ │ └── verror@1.3.6 │ │ │ │ └─┬ sshpk@1.13.1 │ │ │ │ ├── asn1@0.2.3 │ │ │ │ ├── assert-plus@1.0.0 │ │ │ │ ├── bcrypt-pbkdf@1.0.1 │ │ │ │ ├─┬ dashdash@1.14.1 │ │ │ │ │ └── assert-plus@1.0.0 │ │ │ │ ├── ecc-jsbn@0.1.1 │ │ │ │ ├─┬ getpass@0.1.7 │ │ │ │ │ └── assert-plus@1.0.0 │ │ │ │ ├── jsbn@0.1.1 │ │ │ │ └── tweetnacl@0.14.5 │ │ │ ├── is-typedarray@1.0.0 │ │ │ ├── isstream@0.1.2 │ │ │ ├── json-stringify-safe@5.0.1 │ │ │ ├─┬ mime-types@2.1.15 │ │ │ │ └── mime-db@1.27.0 │ │ │ ├── oauth-sign@0.8.2 │ │ │ ├── performance-now@0.2.0 │ │ │ ├── qs@6.4.0 │ │ │ ├── stringstream@0.0.5 │ │ │ ├─┬ tough-cookie@2.3.2 │ │ │ │ └── punycode@1.4.1 │ │ │ ├── tunnel-agent@0.6.0 │ │ │ └── uuid@3.1.0 │ │ ├─┬ rimraf@2.6.1 │ │ │ └─┬ glob@7.1.2 │ │ │ ├── fs.realpath@1.0.0 │ │ │ ├── inflight@1.0.6 │ │ │ ├─┬ minimatch@3.0.4 │ │ │ │ └─┬ brace-expansion@1.1.8 │ │ │ │ ├── balanced-match@1.0.0 │ │ │ │ └── concat-map@0.0.1 │ │ │ └── path-is-absolute@1.0.1 │ │ ├── semver@5.3.0 │ │ ├─┬ tar@2.2.1 │ │ │ ├── block-stream@0.0.9 │ │ │ ├─┬ fstream@1.0.11 │ │ │ │ └── graceful-fs@4.1.11 │ │ │ └── inherits@2.0.3 │ │ └─┬ tar-pack@3.4.0 │ │ ├── fstream-ignore@1.0.5 │ │ ├─┬ once@1.4.0 │ │ │ └── wrappy@1.0.2 │ │ ├─┬ readable-stream@2.3.3 │ │ │ ├── core-util-is@1.0.2 │ │ │ ├── isarray@1.0.0 │ │ │ ├── process-nextick-args@1.0.7 │ │ │ ├── string_decoder@1.0.3 │ │ │ └── util-deprecate@1.0.2 │ │ └── uid-number@0.0.6 │ └── safe-buffer@5.1.1 ├─┬ socket.io@2.0.3 │ ├─┬ debug@2.6.8 │ │ └── ms@2.0.0 │ ├─┬ engine.io@3.1.0 │ │ ├─┬ accepts@1.3.3 │ │ │ ├─┬ mime-types@2.1.15 │ │ │ │ └── mime-db@1.27.0 │ │ │ └── negotiator@0.6.1 │ │ ├── base64id@1.0.0 │ │ ├── cookie@0.3.1 │ │ ├─┬ engine.io-parser@2.1.1 │ │ │ ├── after@0.8.2 │ │ │ ├── arraybuffer.slice@0.0.6 │ │ │ └── blob@0.0.4 │ │ ├── uws@0.14.5 │ │ └─┬ ws@2.3.1 │ │ ├── safe-buffer@5.0.1 │ │ └── ultron@1.1.0 │ ├── object-assign@4.1.1 │ ├─┬ socket.io-adapter@1.1.0 │ │ └─┬ debug@2.3.3 │ │ └── ms@0.7.2 │ ├─┬ socket.io-client@2.0.3 │ │ ├── backo2@1.0.2 │ │ ├── base64-arraybuffer@0.1.5 │ │ ├── component-bind@1.0.0 │ │ ├── component-emitter@1.2.1 │ │ ├─┬ engine.io-client@3.1.1 │ │ │ ├── component-inherit@0.0.3 │ │ │ ├── parsejson@0.0.3 │ │ │ ├── xmlhttprequest-ssl@1.5.3 │ │ │ └── yeast@0.1.2 │ │ ├── has-cors@1.1.0 │ │ ├── indexof@0.0.1 │ │ ├── object-component@0.0.3 │ │ ├─┬ parseqs@0.0.5 │ │ │ └─┬ better-assert@1.0.2 │ │ │ └── callsite@1.0.0 │ │ ├── parseuri@0.0.5 │ │ └── to-array@0.1.4 │ └─┬ socket.io-parser@3.1.2 │ ├── has-binary2@1.0.2 │ └── isarray@2.0.1 └── wiring-pi@2.2.1
Mein erster Versuch war serialport und nodejs-websocket in das Verzeichnis /home/pi/MagicMirror/modules/MMM-Gestures mit npm install hinzuzufügen da in deiner Readme steht unter "Installation" 1. Ein neuer Order entsteht in den man gehen soll. npm install wurde ohne sudo ausgeführt. Seltsamerweise habe ich 2 mal den ordner node_modules, einmal unter /home/pi/ und einmal unter /home/pi/MagicMirror/
I suggest you try it with serialport version 4. You can uninstall the current version with npm uninstall serialport
and afterwards install the latest version 4 via npm install serialport@4.x.x
.
Yes, that did the trick. Now it's a real MagicMirror! Thank you for the help.
i follow you complete instructions. My Arduino Pro Mini is connected to USB-UART Adapter. It´s possible to received the Senor states thrue the Arduino IDE Serial and also with "screen" at the RPI. I try to change the Node.js/gestures.js to have access to the ttyUSB0 device but the pm2 log gestures also try ttyACM*