milights-bridge
milights-bridge copied to clipboard
Error when running server.js
Hi there, I'm following the instructions, I think, fully, but when I issue the command "sudo node server.js" I get the following output, all the build to this point appears successful.
" Setting up EJS... Initialising Milight bridge connection (version v6) Checking for updates...
/home/pi/milights-bridge/server.js:477
.execSync('git rev-parse HEAD')
^
TypeError: Object #<Object> has no method 'execSync'
at getLastCommitId (/home/pi/milights-bridge/server.js:477:4)
at refreshUpdateCache (/home/pi/milights-bridge/server.js:492:14)
at initIBox (/home/pi/milights-bridge/server.js:312:2)
at Server.
Hi!
I must have forgotten to add a package to the package.json. Or the issue could be that you have an older version globally installed.
Running the following command inside the /milights-bridge/
folder should solve the problem temporarily (until next commit):
sudo npm install child_process
If it doesn't work, try
sudo npm install -g child_process
Let me know if you have any other problems!
On the other hand I found a project with a similar issue, let me know if this solved it, otherwise I will implement a similar fix into this project as soon as possible.
Hi KevinVR,
I noticed the same issue when trying to use the code - I am also running this on the RaspberryPi (which has OSMC as the default build) and am getting the same error as the other user.
I ran both version of the install child_process (as recommended above) - see below for output of both attempts.
Attempt 1: after running sudo npm install child_process osmc@osmc:~/milights-bridge$ sudo nodejs server.js Setting up EJS... Initialising Milight bridge connection (version v6) Checking for updates...
/home/osmc/milights-bridge/server.js:477
.execSync('git rev-parse HEAD')
^
TypeError: Object #<Object> has no method 'execSync'
at getLastCommitId (/home/osmc/milights-bridge/server.js:477:4)
at refreshUpdateCache (/home/osmc/milights-bridge/server.js:492:14)
at initIBox (/home/osmc/milights-bridge/server.js:312:2)
at Server.
Attempt 2 osmc@osmc:~/milights-bridge$ sudo npm install -g child_process [email protected] /usr/local/lib/node_modules/child_process osmc@osmc:~/milights-bridge$ sudo nodejs server.js Setting up EJS... Initialising Milight bridge connection (version v6) Checking for updates...
/home/osmc/milights-bridge/server.js:477
.execSync('git rev-parse HEAD')
^
TypeError: Object #<Object> has no method 'execSync'
at getLastCommitId (/home/osmc/milights-bridge/server.js:477:4)
at refreshUpdateCache (/home/osmc/milights-bridge/server.js:492:14)
at initIBox (/home/osmc/milights-bridge/server.js:312:2)
at Server.
Hope this helps with your debugging, happy to test again on the next commit.
Hi KevinVR,
thank you for the great work! Unfortunately, I've got the same issue. Is there any other solution than running the 2 commands? It didn't work for me :( .
Thanks for the information, I will see if I can reproduce the errors.
@mpartoglou @Lucas183 @southchurchbob Sorry for the delay, please make a fresh install, I have updated some things that should solve these problems :).
Let me know if it works!
Now it's a different error message. But still doesn't work for me :(
I think the the problem is that you have "child_process" included as a dependency in package.json which is just a "security holding package on npmjs". My suggestion is that to remove that. As "child_process" is an API of the Node.JS base library there is no dependency entry for that.
@Lucas183, @mpartoglou EDIT: Which version of nodejs are you using? Supposedly, it is anything newer than v0.10?!
node --version
EDIT2: Make sure to uninstall "child_process" again!
sudo npm uninstall child_process
sudo npm uninstall -g child_process
@mwittig Thanks for the advice. However, the error came without that package in the beginning. I need to check whether the execSync function is available, otherwise use the syncExec (such as link below). Let's test the fix I just pushed first.
Also, thank you for making the node-milights-promise
package!
@Lucas183 I forgot to fix the same error in another part of the code, try again please :). It is possible that the update system (latest version) might not work, but this is a temporary fix.
I'll use syncexec (like they did here https://github.com/lerna/lerna/commit/062ae97ea8b33be825670baa43c76f422fd603e6 to solve the same problem) in the future to solve it, if it works like this.
Also, like @mwittig said, make sure you are using a recent NodeJS version.
Hi all,
sorry, I was on vacation, so I wasn't able to test it until now. The issue above seems to be solved, now I get a different one, probably because I did not set it up correcttly, maybe you can help me here.
When I try to control my MiLights with an UDP Sender App I use a different port but that one isn
t working either.