This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
Closed
Noob NodeJS questions.
Hi guys,
I am trying to write my own homey app. and i need some pushes in the right direction. I have programming knowledge but NodeJS is totaly new to me. and between the trees i can't see the Forrest. lol
For this i am stuck at the very beginning of my code. Including a module.
I cant get the inclusion to work.
I have downloaded the nodeJS module at https://github.com/nfarina/homebridge
and placed the files in my app path: nl.nielsdeklerk.homebridge/node_modules/homebridge/
the start of my app.js looks like:
Debug output:
What am i overseeing. looks like it's not a module. but when i look at the code of others i dont know where to look for.
I am trying to write my own homey app. and i need some pushes in the right direction. I have programming knowledge but NodeJS is totaly new to me. and between the trees i can't see the Forrest. lol
For this i am stuck at the very beginning of my code. Including a module.
I cant get the inclusion to work.
I have downloaded the nodeJS module at https://github.com/nfarina/homebridge
and placed the files in my app path: nl.nielsdeklerk.homebridge/node_modules/homebridge/
the start of my app.js looks like:
"use strict"; var http = require('http'); var Accessory, Service, Characteristic, UUIDGen; var homebridge = require('homebridge'); // <- This line fails
Debug output:
------------------------------------------------- Error: Cannot find module 'homebridge' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (/app.js:6:15) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) --- INFO: nl.nielsdeklerk.homebridge has been killed ---
What am i overseeing. looks like it's not a module. but when i look at the code of others i dont know where to look for.
This discussion has been closed.
Comments
Create a directory node_modules (in OSX: mkdir node_modules, Windows should be somewhat similar)
Type in:
git clone https://github.com/nfarina/homebridge
That should do it. Ofcourse, first you'll have to install git if you don't have it.
npm install homebridge --prefix "C:/users/path_to_your_app_nl.nielsdeklerk/"
This should automatically create a folder 'node_modules' in your root folder and will also install all the dependencies of the homebridge node module
/node_modules/mdns/build/Release/dns_sd_bindings.node: invalid ELF header
Because I use a Mac os x to compile this module. it is compiled for Mac os x and not for the Homey os distribution.
Hopefully someone can give me some direction in what kind of OS i need to compile so that these modules will work for Homey.
https://hub.docker.com/r/jsurf/rpi-raspbian/
But i'm getting some node specific error regarding the os.networkInterface(). So i think i'm not able to compile for ARM cpu.