question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SyntaxError: Unexpected token =

See original GitHub issue

When I try to use your example in my local node v5.12.0 instance running on Gentoo Linux, I get the following error:

/home/manny/hs110q/node_modules/hs100-api/index.js:16
function Hs100Api (config = {}) {
                          ^

SyntaxError: Unexpected token =
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/manny/hs110q/index.js:3:18)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

The example I used was:

'use strict';

const Hs100Api = require('hs100-api');
const hs = new Hs100Api({host: '192.168.0.11'});
hs.getSysInfo().then(console.log);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
plasticrakecommented, Jul 17, 2016

Thanks for your input @bartdorsey. I’ve made changes to be compatible for node v4 (tested using 4.4.7)

1reaction
plasticrakecommented, Jul 14, 2016

Ah yes, this is syntax that requires Node 6. I’ll update the package.json to show this dependency. Are you able to use Node 6? It wouldn’t take long to make it compatible with 5 if anybody needs it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >
syntax error: unexpected token - javascript - Stack Overflow
The error SyntaxError: Unexpected token < likely means the API endpoint didn't return JSON in its document body, such as due to a...
Read more >
Have a JavaScript Unexpected Token Error? Check Your Syntax
Today, we are discussing the Unexpected Token Error within our JavaScript Error Handling series. This JavaScript error is a subset of the ...
Read more >
JavaScript SyntaxError - Unexpected token - GeeksforGeeks
This JavaScript exceptions unexpected token occur if a specific language construct was expected, but anything else is typed mistakenly.
Read more >
Nodejs Uncaught SyntaxError: Unexpected token import
Unexpected token error occurs most commonly because the code used for a page referred to the property you have not used anymore or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found