Dasher Crash on Execute Command
bwatson236 opened this issue · 1 comments
bwatson236 commented
When pressing the dash button using HTTP it works fine, however using the command function it crashes, displaying the following:
> dasher@1.4.1 start /home/pi/dasher
> node app.js
[2017-12-14T22:48:46.147Z] Bedroom Overhead Light added.
[2017-12-14T22:51:21.101Z] Bedroom Overhead Light pressed. Count: 1
internal/child_process.js:298
throw errnoException(err, 'spawn');
^
Error: spawn EACCES
at exports._errnoException (util.js:874:11)
at ChildProcess.spawn (internal/child_process.js:298:11)
at exports.spawn (child_process.js:339:9)
at exports.execFile (child_process.js:141:15)
at doCommand (/home/pi/dasher/lib/dasher.js:39:17)
at Readable.<anonymous> (/home/pi/dasher/lib/dasher.js:29:7)
at emitOne (events.js:77:13)
at Readable.emit (events.js:169:7)
at PcapSession.<anonymous> (/home/pi/dasher/node_modules/node-dash-button/index.js:87:28)
at emitOne (events.js:77:13)
npm ERR! Linux 4.1.19-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! dasher@1.4.1 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dasher@1.4.1 start script 'node app.js'.
npm ERR! This is most likely a problem with the dasher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get their info via:
npm ERR! npm owner ls dasher
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/dasher/npm-debug.log
The debug log contains the following:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'start' ]
2 info using npm@2.14.7
3 info using node@v4.2.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart dasher@1.4.1
6 info start dasher@1.4.1
7 verbose unsafe-perm in lifecycle true
8 info dasher@1.4.1 Failed to exec start script
9 verbose stack Error: dasher@1.4.1 start: `node app.js`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:818:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid dasher@1.4.1
11 verbose cwd /home/pi/dasher
12 error Linux 4.1.19-v7+
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
14 error node v4.2.1
15 error npm v2.14.7
16 error code ELIFECYCLE
17 error dasher@1.4.1 start: `node app.js`
17 error Exit status 1
18 error Failed at the dasher@1.4.1 start script 'node app.js'.
18 error This is most likely a problem with the dasher package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node app.js
18 error You can get their info via:
18 error npm owner ls dasher
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
My config.json file contains the following:
{"buttons":[
{
"name": "Bedroom Overhead Light",
"address": "50:f5:00:00:00:00",
"protocol": "udp",
"cmd": "/home/pi/Hue/toggle.sh"
}
]}
The script to be executed contains the following:
#!/bin/bash
wget http://192.168.1.100/api/user/lights/3
var="$(jq '.state.on' 3)"
rm 3
if $var = true
then curl -X PUT "http://10.0.0.13/api/user/lights/3/state" -H "Content-Type: application/json" -d '{"on":false}'
else curl -X PUT "http://10.0.0.13/api/user/lights/3/state" -H "Content-Type: application/json" -d '{"on":true}'
fi
Running the script alone works fine.
Any and all help would be greatly appreciated.
Thank You.
bwatson236 commented
Update: I forgot to chmod the file. All is well now. Cheers.