Open Dirtrunner702 opened 7 years ago
Whooohooo the first Windows user and thanks for the feedback! ;)
Okay this one might be a tough one to debug because I have no machine with Windows around but I'll try my best.
Could you please try to use forward-slashes in the file-paths? E.g.:
"log": "C:/Users/Username/output.log"
or
"log": "C:\\Users\Username\output.log"
Does one of these work?
Hey! Yea man! Its been a fun project to tackle with the setup and I'm looking forward to doing all the cool things with it up and running completely!
So I tried the first suggestion "log": "C:/Users/HomeBridge/output.log". The service starts correctly but when trying to view the log it crashes and gives this error , see below.
C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge\bin>Node Homebridge [1/19/2017, 12:00:41 AM] Loaded plugin: homebridge-http [1/19/2017, 12:00:41 AM] Registering accessory 'homebridge-http.Http' [1/19/2017, 12:00:41 AM] --- [1/19/2017, 12:00:41 AM] Loaded plugin: homebridge-server [1/19/2017, 12:00:41 AM] Registering platform 'homebridge-server.Server' [1/19/2017, 12:00:41 AM] --- [1/19/2017, 12:00:41 AM] Loaded config.json with 0 accessories and 1 platforms. [1/19/2017, 12:00:41 AM] --- [1/19/2017, 12:00:41 AM] Loading 1 platforms... [1/19/2017, 12:00:41 AM] [Homebridge Server] Initializing Server platform... [1/19/2017, 12:00:41 AM] Loading 0 accessories... Scan this code with your HomeKit App on your iOS device to pair with Homebridge:
┌────────────┐
│ 031-45-154 │
└────────────┘
[1/19/2017, 12:00:41 AM] [Homebridge Server] is listening on: http://192.168.86.130:8765 [1/19/2017, 12:00:42 AM] Homebridge is running on port 51826. C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge-server\index.js:453 return log(err); ^ TypeError: log is not a function at ReadFileContext.callback (C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge-server\index.js:453:34) at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:324:13)
The second suggestion "log": "C:\Users\HomeBridge\output.log" Does not allow the service to start and throws the following error.
C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge\bin>Node Homebridge [1/18/2017, 11:57:58 PM] Loaded plugin: homebridge-http [1/18/2017, 11:57:58 PM] Registering accessory 'homebridge-http.Http' [1/18/2017, 11:57:58 PM] --- [1/18/2017, 11:57:58 PM] Loaded plugin: homebridge-server [1/18/2017, 11:57:58 PM] Registering platform 'homebridge-server.Server' [1/18/2017, 11:57:58 PM] --- [1/18/2017, 11:57:58 PM] There was a problem reading your config.json file. [1/18/2017, 11:57:58 PM] Please try pasting your config.json file here to validate it: http://jsonlint.com [1/18/2017, 11:57:58 PM] C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge\lib\server.js:197 throw err; ^
SyntaxError: Unexpected token H
at Object.parse (native)
at Server._loadConfig (C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge\lib\server.js:191:19)
at new Server (C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge\lib\server.js:52:38)
at module.exports (C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge\lib\cli.js:26:16)
at Object.
Okay lets try some hacking together:
First stick in your config with the path:
"log": "C:/Users/HomeBridge/output.log"
and then please open the file C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge-server\index.js
in a text editor like notepad
or alike and search for the following part:
logFile.readFile(config.log, 'utf8', function(err, log) {
replace it with:
logFile.readFile(path.normalize(config.log), 'utf8', function(err, log) {
Then save the file restart your homebridge and report back. 🙏
Ok did exactly as you said, Restarted Homebridge, It started fine. Went to open the log again and it crashed with the following:
C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge-server\index.js:451 logFile.readFile(path.normalize(config.log), 'utf8', function(err, log) { ^ ReferenceError: path is not defined at Server.handleRequest (C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge-server\index.js:451:36) at emitTwo (events.js:87:13) at Server.emit (events.js:172:7) at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:527:12) at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
Grrrr.... yeah for sure I forgot something -.- sorry for that.
In the same file search for:
var http = require('http');
and add below:
var path = require('path');
It now should look like:
var http = require('http');
var path = require('path');
Then restart the service.
Hmm maybe now I can try another syntax for the log path? This is the error with those changes
C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge-server\index.js:454 return log(err); ^
TypeError: log is not a function at ReadFileContext.callback (C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge-server\index.js:454:34) at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:324:13)
Okay I'll try to setup a Windows VM for testing and I'll get back to you as soon as I can. Sorry for the inconvenience :(
Otherwise if you get it up and running with a different path it would be perfect if you could drop me a message - thanks!
Awesome!
Thanks for the suggestions once more, but the same keeps happening as before. So for now I just have to not click the Log tab and all is good!
Hey @Dirtrunner702!,
Sorry for the delay on the update - last weekend I tried to setup Homebridge on Windows which wasn't as easy as thought.
Until now I am not quite sure if this solves the problem but indeed, could you please try another log-path as:
"log": "C:\Users\Username\output.log"
And if you still have the adaptions in the index.js
-file then you're good to go, otherwise please reapply them first.
If this doesn't work as well, try:
"log": "C:\\Users\\Username\\output.log"
Thanks!
P.S.: Paths and alike are sadly the most difficult part in these cross-platform-projects
Thank you for all the help and good communication! Unfortunately both of those methods don't allow homebridge to run. The only methods that keep homebridge working but still do not output the log are the following "log": "C://Users/HomeBridge/output.log", "log": "C:/Users/HomeBridge/output.log",
Its not a huge problem as long as I do not click the Log tab!
Thank you!
I can send you a vmdk of my VM running win10 and Homebridge I can drop box it for you but its about 40GB. If it will help with development id be happy to help!
Oh this would indeed be a great help - could you squeeze it somehow and upload it? Feel free to write me an email and I'll try to fix it asap. Thanks!
Hello,
I read the post and looks like we still trying to fix the path I'm able to use Homebridge-Server on windows its run but the logs are never been written there..
I can test few recommendations if you want, just let me know.
Cheers,
Hm.. is there a happy Windows ending? I'm using \\ in log path just fine, but the log file is neither created nor written to. When created manually, empty log is displayed in config-ui-x without errors though.
Using just homebridge.log as a full path doesn't help too - still no writes.
did anyone ever get any traction on this? I'm experiencing the same issue and cannot get anything to write to a log file.
I am sorry but at the moment I can't provide a windows-setup - I'd be really thankful if someone with windows and some interest in node could support me! # #
Hello! First off thank you for your amazing work. Its very fancy! I have a few things I would like help with. I am currently running HomeBridge Server on Windows 10 and it seems to be running ok. The problem I have is that if I add anything other than "system" for the log path entry here: "platform": "Server", "port" : 8765, "name" : "Homebridge Server", "log" : "",
"restart" : ""
The service does not start. Ive tried windows variable paths, UNC paths such as "C:\Users\Username\output.log and even c:\users\username\Output.log.
Neither option works and therefor stops the service from running. I can leave it systemd but when I click the log tab in the interface the service crashes.
Also, for the restart value I want to either stop/start the task or even just execute shutdown /r /t 0 and I have a script that starts the service on reboot. Neither option seems to be allowed and does not allow the service to start.
Any advice?