Giter Site home page Giter Site logo

Comments (15)

gismo141 avatar gismo141 commented on May 25, 2024

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?

from homebridge-server.

Dirtrunner702 avatar Dirtrunner702 commented on May 25, 2024

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. (C:\Users\HomeBridge\AppData\Roaming\npm\node_modules\homebridge\bin\Homebridge:17:22)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:457:10)

from homebridge-server.

gismo141 avatar gismo141 commented on May 25, 2024

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. 🙏

from homebridge-server.

Dirtrunner702 avatar Dirtrunner702 commented on May 25, 2024

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)

from homebridge-server.

gismo141 avatar gismo141 commented on May 25, 2024

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.

from homebridge-server.

Dirtrunner702 avatar Dirtrunner702 commented on May 25, 2024

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)

from homebridge-server.

gismo141 avatar gismo141 commented on May 25, 2024

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!

from homebridge-server.

Dirtrunner702 avatar Dirtrunner702 commented on May 25, 2024

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!

from homebridge-server.

gismo141 avatar gismo141 commented on May 25, 2024

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

from homebridge-server.

Dirtrunner702 avatar Dirtrunner702 commented on May 25, 2024

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!

from homebridge-server.

gismo141 avatar gismo141 commented on May 25, 2024

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!

from homebridge-server.

prbreezy avatar prbreezy commented on May 25, 2024

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,

from homebridge-server.

i3laze avatar i3laze commented on May 25, 2024

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.

from homebridge-server.

400HPMustang avatar 400HPMustang commented on May 25, 2024

did anyone ever get any traction on this? I'm experiencing the same issue and cannot get anything to write to a log file.

from homebridge-server.

gismo141 avatar gismo141 commented on May 25, 2024

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! # #

from homebridge-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.