Skip to content

TypeError: smartthings is not a constructor #2

@ymfHU

Description

@ymfHU

Node version: v10.9.0

I used the CommonJS version:

var smartthings = require('smartthings-node');
var st = new smartthings("MY-PERSONAL-ACCESS-TOKEN");

st.devices.listDevicesByCapability('switch')
    .then(deviceList => {
        console.log(deviceList);
    });

The full error message:

TypeError: smartthings is not a constructor
    at Object.<anonymous> (/MY-APP-DIR/app.js:52:10)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions