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

TypeError: Arguments to path.join must be strings #27

Open
randy993 opened this issue Feb 22, 2019 · 1 comment
Open

TypeError: Arguments to path.join must be strings #27

randy993 opened this issue Feb 22, 2019 · 1 comment

Comments

@randy993
Copy link

Hi there,

I have an issue running this on my Synology NAS. Wondering if you could help me solve the problem.

When I run my code locally, for example;

        var lgtv = require('lgtv2')({
        url: 'ws://192.168.178.31:3000'
    });

    lgtv.on('error', function(err) {
        console.log(err);
    });

    lgtv.on('connect', function() {
        console.log('connected');
        lgtv.request('ssap://system/turnOff', function(err, res) {
            lgtv.disconnect();
        });

    });

It run's fine. However, the same code, deployed to my Synology NAS, results in an error.

TypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at exports.join (path.js:358:36)
at module.exports (/volume1/web/NodeJS/node_modules/persist-path/index.js:19:22)
at new LGTV (/volume1/web/NodeJS/node_modules/lgtv2/index.js:47:16)
at LGTV (/volume1/web/NodeJS/node_modules/lgtv2/index.js:38:16)
at Object.module.exports.setNetflix (/volume1/web/NodeJS/controllers/tv.js:50:36)
at /volume1/web/NodeJS/routes/routes.js:43:12
at Layer.handle [as handle_request] (/volume1/web/NodeJS/node_modules/express/lib/router/layer.js:95:5)
at next (/volume1/web/NodeJS/node_modules/express/lib/router/route.js:137:13)

The only actual difference I can spot is the NPM version, which is v10.14.1 locally and v0.10.48 on my NAS. Is there any way to bypass this problem and get this working?

@adyromantika
Copy link

adyromantika commented Nov 13, 2019

I had the same error when I tried to run via systemd on the Raspberry Pi. Tracing the stack trace I was able to pinpoint the problem with my service.

lgtv2 uses the persist-path module.

If you look here https://github.com/hobbyquaker/persist-path/blob/master/index.js it looks for either APPDATA or HOME. Either one of those environment variables must be available when running your application.

In my case, I simply left out User directive in my service definition so no HOME variable existed.

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