dot-build / telegram-js

[deprecated] Entrypoint library for Telegram API. Try https://github.com/alik0211/mtproto-core instead
54 stars 8 forks source link

Problem running sample.js #3

Closed HellScre4m closed 1 year ago

HellScre4m commented 7 years ago

Hey.

C:\Users\Sobhan\Documents\NodeJS\telegram-js>node sample.js
C:\Users\Sobhan\Documents\NodeJS\telegram-js\sample.js:1
(function (exports, require, module, __filename, __dirname) { import { Telegram } from 'telegram-js';
                                                              ^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

Can you tell me what's wrong?

darlanalves commented 7 years ago

Hello :)

Yes, you are trying to run an ES6 module using a version of Node.JS that does not support it yet. You have to either use a bundling tool or update your node to use the lib.

henry-cc commented 7 years ago

Hm, I'm also getting this issue. Using the most recent version of node, node v6.9.2.

goodmind commented 7 years ago

@henry-cc nodejs doesn't support ES6 imports