SyntaxError: Unexpected token =
See original GitHub issueWhen 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:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for your input @bartdorsey. I’ve made changes to be compatible for node v4 (tested using 4.4.7)
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.