Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows x64: Error Arguments to path.join must be strings #5

Open
nzhome opened this issue Sep 7, 2015 · 24 comments
Open

Windows x64: Error Arguments to path.join must be strings #5

nzhome opened this issue Sep 7, 2015 · 24 comments

Comments

@nzhome
Copy link

nzhome commented Sep 7, 2015

C:\Program Files\nodejs\node_modules\homestar\app>node homestar setup

C:\Program Files\nodejs\node_modules\homestar\app>node app.js
{"name":"iotdb-homestar","module":"app/recipe","hostname":"MYHOMEPC","pid":15040,"level":30,"method":"_load_recipes","cookbooks_path":"cookbooks","msg":"loading recipes","time":"2015-09-07T08:16:26.761Z","v":0}
{"name":"iotdb","module":"IOT","hostname":"MYHOMEPC","pid":15040,"level":30,"method":"_exit_cleanup","paramd":{"from":"exit"},"err":1,"msg":"start","time":"2015-09-07T08:16:26.765Z","v":0}
path.js:233
throw new TypeError('Arguments to path.join must be strings');
^
TypeError: Arguments to path.join must be strings
at Object.win32.join (path.js:233:13)
at Object.exports.cfg_envd (C:\Program Files\nodejs\node_modules\homestar\node_modules\iotdb\cfg.js:387:36)
at Keystore._load (C:\Program Files\nodejs\node_modules\homestar\node_modules\iotdb\keystore.js:76:38)
at new Keystore (C:\Program Files\nodejs\node_modules\homestar\node_modules\iotdb\keystore.js:57:10)
at Object.keystore (C:\Program Files\nodejs\node_modules\homestar\node_modules\iotdb\keystore.js:191:21)
at Object.setup (C:\Program Files\nodejs\node_modules\homestar\app\settings.js:169:19)
at Object. (C:\Program Files\nodejs\node_modules\homestar\app\app.js:758:10)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)

C:\Program Files\nodejs\node_modules\homestar\app>

@dpjanes
Copy link
Owner

dpjanes commented Sep 7, 2015

What's in "app.js"

@dpjanes
Copy link
Owner

dpjanes commented Sep 7, 2015

Als (because of this line)
envd.IOTDB_CFG = node_path.join(process.env['HOME'], ".iotdb");

what's in process.env['HOME']?

@nzhome
Copy link
Author

nzhome commented Sep 9, 2015

the other two directory detections in there seems to work just fine. can you do another check to skip if it is undefined, because it looks like it will eventually find a good directory folder soon afterwards...

      console.log('process.envHOME: ' + process.env['HOME']);
      console.log('__dirname: ' + __dirname);
      console.log('node_path.dirname(process.argv[1]): ' + node_path.dirname(process.argv[1]));

process.envHOME: undefined
__dirname: C:\Program Files\nodejs\node_modules\homestar\node_modules\iotdb
node_path.dirname(process.argv[1]): C:\Program Files\nodejs\node_modules\homestar\app

exports.cfg_envd = function (envd) {
envd = _.defaults(envd, {});

for (var key in process.env) {
    var value = process.env[key];
    if (!envd[key] && _.is.String(value)) {
        envd[key] = value;
    }
}

if (!envd.IOTDB_CFG) {
      console.log('process.envHOME: ' + process.env['HOME']);
      console.log('__dirname: ' + __dirname);
      console.log('process.argv[1]: ' + process.argv[1]);
    envd.IOTDB_CFG = node_path.join(process.env['HOME'], ".iotdb");
}

if (!envd.IOTDB_INSTALL) {
    envd.IOTDB_INSTALL = __dirname;
}

if (!envd.IOTDB_PROJECT) {
    envd.IOTDB_PROJECT = node_path.dirname(process.argv[1]);
}

@dpjanes
Copy link
Owner

dpjanes commented Sep 9, 2015

It won't try to define IOTDB_CFG if there's no HOME. Try it now.

@nzhome
Copy link
Author

nzhome commented Sep 9, 2015

you have to commit the change before I can see it.

@nzhome
Copy link
Author

nzhome commented Sep 9, 2015

now it has this message...

{"name":"iotdb-homestar","module":"app/recipe","hostname":"MYHOMEPC","pid":24616,"level":30,"method":"_load_recipes","cookbooks_path":"cookbooks","msg":"loading recipes","time":"2015-09-09T11:48:47.144Z","v":0}
{"name":"iotdb-homestar","module":"app/settings","hostname":"MYHOMEPC","pid":24616,"level":50,"method":"setup","cause":"admin hasn't completed setup","fix":"$ homestar set secrets/host 0 --uuid","msg":"missing secret","time":"2015-09-09T11:48:47.149Z","v":0}

@dpjanes
Copy link
Owner

dpjanes commented Sep 9, 2015

Have you done "homestar setup"? If you have, this may be a cascade error
from ignoring the HOME directory. Is there an equivalent on Windows?

On Wed, Sep 9, 2015 at 7:50 AM, nzhome notifications@github.com wrote:

now it has this message...

{"name":"iotdb-homestar","module":"app/recipe","hostname":"MYHOMEPC","pid":24616,"level":30,"method":"_load_recipes","cookbooks_path":"cookbooks","msg":"loading
recipes","time":"2015-09-09T11:48:47.144Z","v":0}
{"name":"iotdb-homestar","module":"app/settings","hostname":"MYHOMEPC","pid":24616,"level":50,"method":"setup","cause":"admin
hasn't completed setup","fix":"$ homestar set secrets/host 0
--uuid","msg":"missing secret","time":"2015-09-09T11:48:47.149Z","v":0}


Reply to this email directly or view it on GitHub
#5 (comment)
.

@nzhome
Copy link
Author

nzhome commented Sep 14, 2015

yep. .. hey dpjanes did you write all this software on your own? Have you had a look at the very active nodejs homebridge project that brought me to your one?

@nzhome
Copy link
Author

nzhome commented Sep 14, 2015

I have an idea, I will try

envd.IOTDB_CFG = node_path.join(__dirname, ".iotdb");

@nzhome
Copy link
Author

nzhome commented Sep 14, 2015

nope that didn't work.

I thought /homestar/runner was optional. i don't have any secret keys. why is it forcing me to have runner secret keys?

@dpjanes
Copy link
Owner

dpjanes commented Sep 14, 2015

I wasn't familiar with homebridge. Thanks for pointing this out - I'll have
a look. I was familiar with https://github.com/KhaosT/HAP-NodeJS

There is nothing forcing you to have secret keys, so whatever error you are
having is not because of that. It just telling you that you don't have keys
installed! It's easy to get keys, just go to HomeStar.io and add some.

You still have to do "homestar setup" no matter what. This is a
non-optional step and is what causes this error

{"name":"iotdb-homestar","module":"app/settings","
hostname":"MYHOMEPC","pid":24616,"level":50,"method":"setup","cause":"admin
hasn't completed setup","fix":"$ homestar set secrets/host 0
--uuid","msg":"missing secret","time":"2015-09-09T11:48:47.149Z","v":0}

D.

On Mon, Sep 14, 2015 at 3:31 AM, nzhome notifications@github.com wrote:

nope that didn't work.

I thought /homestar/runner was optional. i don't have any secret keys. why
is it forcing me to have runner secret keys?


Reply to this email directly or view it on GitHub
#5 (comment)
.

@dpjanes
Copy link
Owner

dpjanes commented Sep 14, 2015

Or to reiterate

  1. have you done "homestar setup"
  2. if you have, what's the error now?

@nzhome
Copy link
Author

nzhome commented Sep 14, 2015

  1. yes I have done homestar setup 20 times, I do homestar setup everyday for the last 7 days.. still doesn't seem to work.

  2. same error.

I will keep trying.

@dpjanes
Copy link
Owner

dpjanes commented Sep 14, 2015

Sorry, specifically what is the error?

D.

On Monday, September 14, 2015, nzhome notifications@github.com wrote:

  1. yes I have done homestar setup 20 times, I do homestar setup everyday
    for the last 7 days.. still doesn't seem to work.

  2. same error.

I will keep trying.


Reply to this email directly or view it on GitHub
#5 (comment)
.

@nzhome
Copy link
Author

nzhome commented Sep 14, 2015

there is no error when running homestar setup, it just returns to the console without writting anything to the screen.

and running homestar normally gives
{"name":"iotdb-homestar","module":"app/settings"," hostname":"MYHOMEPC","pid":24616,"level":50,"method":"setup","cause":"admin hasn't completed setup","fix":"$ homestar set secrets/host 0 --uuid","msg":"missing secret","time":"2015-09-09T11:48:47.149Z","v":0}

@dpjanes
Copy link
Owner

dpjanes commented Sep 14, 2015

Hmmm. OK, I'm going to boot up a Windows machine tomorrow and try to
replicate this.

D

On Mon, Sep 14, 2015 at 4:04 PM, nzhome notifications@github.com wrote:

there is no error when running homestar setup, it just returns to the
console without writting anything to the screen.

and running homestar normally gives
{"name":"iotdb-homestar","module":"app/settings","
hostname":"MYHOMEPC","pid":24616,"level":50,"method":"setup","cause":"admin
hasn't completed setup","fix":"$ homestar set secrets/host 0
--uuid","msg":"missing secret","time":"2015-09-09T11:48:47.149Z","v":0}


Reply to this email directly or view it on GitHub
#5 (comment)
.

@dpjanes
Copy link
Owner

dpjanes commented Sep 15, 2015

I'm betting that you got a whole bunch of errors when you ran "homestar setup". I think I've found all the "unix-isms" and got it working on Windows - it's working on mine now.

npm uninstall -g homestar
npm install homestar

homestar help
// that should list help
homestar setup
// should printing interesting stuff about your location
homestar install homestar-wemo
// assuming you have a WeMo
homestar runner
// it should be working

Let me know!

@nzhome
Copy link
Author

nzhome commented Sep 16, 2015

odd thing is that

homestar help

homestar setup

does nothing, it can't even find "homestar"

and typing cd homestar/app
and typing node app.js
is the only way to start the app.

typing node app.js setup
does nothing.

how can I make my windows execute homestar like you do?

@dpjanes
Copy link
Owner

dpjanes commented Sep 16, 2015

Do you mean it does nothing, or it reports an error

Did you start with "npm install -g homestar"?

If you didn't that's the problem.
If you did, then likely you didn't install NodeJS correctly on windows.
Make sure that wherever it is Node / NPM installs applications, it is on
your PATH. This should have been set up when Node was installed.

D.

On Tue, Sep 15, 2015 at 8:54 PM, nzhome notifications@github.com wrote:

odd thing is that

homestar help

homestar setup

does nothing, it can't even find "homestar"

and typing cd homestar/app
and typing node app.js
is the only way to start the app.

typing node app.js setup

does nothing.

how can I make my windows execute homestar like you do?


Reply to this email directly or view it on GitHub
#5 (comment)
.

@nzhome
Copy link
Author

nzhome commented Sep 16, 2015

  1. yep I can type "npm install -g homestar" on any path and it works.. so that means my node path is ok right?

C:\Program Files\nodejs\node_modules>npm install -g homestar

ws@0.4.32 install C:\Users\Hamish\AppData\Roaming\npm\node_modules\homestar\node_modules\mows\node_modules\ws
(node-gyp rebuild 2> builderror.log) || (exit 0)
...
C:\Users\Hamish\AppData\Roaming\npm\homestar -> C:\Users\Hamish\AppData\Roaming\npm\node_modules\homestar\bin\homestar
homestar@0.2.14 C:\Users\Hamish\AppData\Roaming\npm\node_modules\homestar
├── url-join@0.0.1
├── connect-fs@0.1.1
├── open@0.0.5
├── iotdb-transport@0.0.11
├── iotdb-recipes@0.0.5
├── uuid@2.0.1
├── minimist@1.2.0
├── cookie-parser@1.3.5 (cookie@0.1.3, cookie-signature@1.0.6)
├── passport@0.3.0 (pause@0.0.1, passport-strategy@1.0.0)
├── express-session@1.11.3 (cookie@0.1.3, cookie-signature@1.0.6, utils-merge@1.0.0, on-headers@1.0.0, parseurl@1.3.0, depd@1.0.1, crc@3.3.0, uid-safe@2.0.0, debug@2.2.0)
├── iotdb@0.10.10 (canonical-json@0.0.4, node-uuid@1.4.3, underscore@1.8.3)
├── iotdb-transport-iotdb@0.0.12 (validate@2.1.6)
├── iotdb-transport-express@0.0.18 (validate@2.1.6)
├── iotdb-transport-firebase@0.0.18 (validate@2.1.6)
├── iotdb-transport-mqtt@0.0.12 (validate@2.1.6)
├── iotdb-transport-fs@0.0.16 (rwlock@5.0.0, mkdirp@0.5.1, validate@2.1.6, watch@0.16.0)
├── passport-twitter@1.0.3 (xtraverse@0.1.0, passport-oauth1@1.0.1)
├── body-parser@1.13.3 (bytes@2.1.0, content-type@1.0.1, depd@1.0.1, qs@4.0.0, debug@2.2.0, raw-body@2.1.3, on-finished@2.3.0, http-errors@1.3.1, iconv-lite@0.4.11, type-is@1.6.8)
├── express@4.13.3 (escape-html@1.0.2, merge-descriptors@1.0.0, array-flatten@1.1.1, cookie@0.1.3, utils-merge@1.0.0, cookie-signature@1.0.6, methods@1.1.1, fresh@0.3.0, range-parser@1.0.2, vary@1.0.1, path-to-regexp@0.1.7, content-type@1.0.1, etag@1.7.0, parseurl@1.3.0, content-disposition@0.5.0, serve-static@1.10.0, depd@1.0.1, qs@4.0.0, debug@2.2.0, finalhandler@0.4.0, on-finished@2.3.0, proxy-addr@1.0.8,
├── session-file-store@0.0.20 (bagpipe@0.3.5, retry@0.6.1, fs-extra@0.23.1)
├── prompt@0.2.14 (revalidator@0.1.8, pkginfo@0.3.0, read@1.0.7, winston@0.8.3, utile@0.2.1)
├── jsonwebtoken@5.0.5 (jws@3.1.0)
├── firebase@2.2.9 (faye-websocket@0.9.3)
├── iotdb-timers@0.0.11 (suncalc@1.6.0, moment@2.9.0)
├── swig@1.4.2 (optimist@0.6.1, uglify-js@2.4.24)
├── unirest@0.4.2 (mime@1.2.11, form-data@0.2.0, request@2.51.0)
├── mows@0.0.6 (websocket-stream@0.5.1, mqtt@0.3.13, ws@0.4.32)
├── bunyan@1.5.1 (safe-json-stringify@1.0.3, mv@2.1.1, dtrace-provider@0.6.0)
└── mqtt@1.4.1 (inherits@2.0.1, xtend@4.0.0, commist@1.0.0, mqtt-connection@2.1.1, readable-stream@1.0.33, mqtt-packet@3.4.1, end-of-stream@1.1.0, help-me@0.1.0, concat-stream@1.5.0, websocket-stream@2.0.2)

C:\Program Files\nodejs\node_modules>homestar setup
'homestar' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\nodejs\node_modules>cd ..

C:\Program Files\nodejs>homestar setup
'homestar' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\nodejs>cd node_modules

C:\Program Files\nodejs\node_modules>cd homestar

C:\Program Files\nodejs\node_modules\homestar>homestar setup
'homestar' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\nodejs\node_modules\homestar>cd app

C:\Program Files\nodejs\node_modules\homestar\app>homestar setup

C:\Program Files\nodejs\node_modules\homestar\app>cd ..

C:\Program Files\nodejs\node_modules\homestar>cd ..

C:\Program Files\nodejs\node_modules>cd ..

@dpjanes
Copy link
Owner

dpjanes commented Sep 17, 2015

  1. means Node and NPM is installed properly BUT the fact the command
    "homestar" isn't available means that something isn't set up correctly. I
    think there's an option when you install.

ALSO: I just don't run DOS, I ran the "Node Shell" or something like that,
under the Start Menu > Programs > Node JS > Node Shell (or something). That
might solve the problem.

On Wed, Sep 16, 2015 at 3:48 PM, nzhome notifications@github.com wrote:

  1. yep I can type "npm install -g homestar" on any path and it works.. so
    that means my node path is ok right?

C:\Program Files\nodejs\node_modules>npm install -g homestar

ws@0.4.32 install
C:\Users\Hamish\AppData\Roaming\npm\node_modules\homestar\node_modules\mows\node_modules\ws
(node-gyp rebuild 2> builderror.log) || (exit 0)
...
C:\Users\Hamish\AppData\Roaming\npm\homestar ->
C:\Users\Hamish\AppData\Roaming\npm\node_modules\homestar\bin\homestar
homestar@0.2.14 C:\Users\Hamish\AppData\Roaming\npm\node_modules\homestar
├── url-join@0.0.1
├── connect-fs@0.1.1
├── open@0.0.5
├── iotdb-transport@0.0.11
├── iotdb-recipes@0.0.5
├── uuid@2.0.1
├── minimist@1.2.0
├── cookie-parser@1.3.5 (cookie@0.1.3, cookie-signature@1.0.6)
├── passport@0.3.0 (pause@0.0.1, passport-strategy@1.0.0)
├── express-session@1.11.3 (cookie@0.1.3, cookie-signature@1.0.6,
utils-merge@1.0.0, on-headers@1.0.0, parseurl@1.3.0, depd@1.0.1, crc@3.3.0,
uid-safe@2.0.0, debug@2.2.0)
├── iotdb@0.10.10 (canonical-json@0.0.4, node-uuid@1.4.3, underscore@1.8.3
)
├── iotdb-transport-iotdb@0.0.12 (validate@2.1.6)
├── iotdb-transport-express@0.0.18 (validate@2.1.6)
├── iotdb-transport-firebase@0.0.18 (validate@2.1.6)
├── iotdb-transport-mqtt@0.0.12 (validate@2.1.6)
├── iotdb-transport-fs@0.0.16 (rwlock@5.0.0, mkdirp@0.5.1, validate@2.1.6,
watch@0.16.0)
├── passport-twitter@1.0.3 (xtraverse@0.1.0, passport-oauth1@1.0.1)
├── body-parser@1.13.3 (bytes@2.1.0, content-type@1.0.1, depd@1.0.1,
qs@4.0.0, debug@2.2.0, raw-body@2.1.3, on-finished@2.3.0,
http-errors@1.3.1, iconv-lite@0.4.11, type-is@1.6.8)
├── express@4.13.3 (escape-html@1.0.2, merge-descriptors@1.0.0,
array-flatten@1.1.1, cookie@0.1.3, utils-merge@1.0.0,
cookie-signature@1.0.6, methods@1.1.1, fresh@0.3.0, range-parser@1.0.2,
vary@1.0.1, path-to-regexp@0.1.7, content-type@1.0.1, etag@1.7.0,
parseurl@1.3.0, content-disposition@0.5.0, serve-static@1.10.0, depd@1.0.1,
qs@4.0.0, debug@2.2.0, finalhandler@0.4.0, on-finished@2.3.0,
proxy-addr@1.0.8,
├── session-file-store@0.0.20 (bagpipe@0.3.5, retry@0.6.1, fs-extra@0.23.1
)
├── prompt@0.2.14 (revalidator@0.1.8, pkginfo@0.3.0, read@1.0.7,
winston@0.8.3, utile@0.2.1)
├── jsonwebtoken@5.0.5 (jws@3.1.0)
├── firebase@2.2.9 (faye-websocket@0.9.3)
├── iotdb-timers@0.0.11 (suncalc@1.6.0, moment@2.9.0)
├── swig@1.4.2 (optimist@0.6.1, uglify-js@2.4.24)
├── unirest@0.4.2 (mime@1.2.11, form-data@0.2.0, request@2.51.0)
├── mows@0.0.6 (websocket-stream@0.5.1, mqtt@0.3.13, ws@0.4.32)
├── bunyan@1.5.1 (safe-json-stringify@1.0.3, mv@2.1.1,
dtrace-provider@0.6.0)
└── mqtt@1.4.1 (inherits@2.0.1, xtend@4.0.0, commist@1.0.0,
mqtt-connection@2.1.1, readable-stream@1.0.33, mqtt-packet@3.4.1,
end-of-stream@1.1.0, help-me@0.1.0, concat-stream@1.5.0,
websocket-stream@2.0.2)

C:\Program Files\nodejs\node_modules>homestar setup
'homestar' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\nodejs\node_modules>cd ..

C:\Program Files\nodejs>homestar setup
'homestar' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\nodejs>cd node_modules

C:\Program Files\nodejs\node_modules>cd homestar

C:\Program Files\nodejs\node_modules\homestar>homestar setup
'homestar' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\nodejs\node_modules\homestar>cd app

C:\Program Files\nodejs\node_modules\homestar\app>homestar setup

C:\Program Files\nodejs\node_modules\homestar\app>cd ..

C:\Program Files\nodejs\node_modules\homestar>cd ..

C:\Program Files\nodejs\node_modules>cd ..


Reply to this email directly or view it on GitHub
#5 (comment)
.

@nzhome
Copy link
Author

nzhome commented Sep 23, 2015

I finally figured it out.. I had to open a cmd window

copy homestar to this folder
cd C:\Users\username\AppData\Roaming\npm\node_modules
homestar setup

probably has something to do with the -g command line and the homestar.cmd file it creates in that folder.

npm install -g homestar

or something like that, now I get correctly

C:\Users\username\AppData\Roaming\npm>homestar setup
change: host → e53b691a-c918-48a2-b4d0-d59532e9ad54
change: session → 22c9ed4c-246a-488e-bb20-b208dc0d164e
change: machine_id → 1cc00972-31ac-4a8a-b7b6-52560ac74c84
change: latitude → -36.8641
change: longitude → 174.7621
change: locality → Auckland
change: country → NZ
change: region → AUK
change: timezone → Pacific/Auckland
change: postal_code → 1010

@dpjanes
Copy link
Owner

dpjanes commented Oct 6, 2015

If this is good, can you close please!

@nzhome
Copy link
Author

nzhome commented Oct 8, 2015

nope, it still does not work. seems there is issues with homestar. all my other npm nodejs work fine on my PC and RaspberryPI2, its just homestar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants