I've been fighting with this for a couple of hours and I can't seem to work out why I can't get the simple example to execute.
I'm sure I'm doing something incredibly stupid, so any help you could provide would be appreciated.
I'm currently using Node 10.11.0 and I'm getting the following error from the example:
import UserAgent from "user-agents";
const userAgent = new UserAgent();
console.log(userAgent.toString());
console.log(JSON.stringify(userAgent.data, null, 2));
node index.js
~/apps/bunraku/spike/index.js:1
(function (exports, require, module, __filename, __dirname) { import UserAgent from "user-agents";
^^^^^^^^^
SyntaxError: Unexpected identifier
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
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:279:19)
I've been fighting with this for a couple of hours and I can't seem to work out why I can't get the simple example to execute.
I'm sure I'm doing something incredibly stupid, so any help you could provide would be appreciated.
I'm currently using Node
10.11.0
and I'm getting the following error from the example:Here is my
package.json
:And my
package-lock.json
: