You are reading a single comment by @jgw and its replies. Click here to read the full conversation.
  • That already is better, but...
    Another error is presented (which I do not have in Web IDE). I can reproduce it with the following :

    var dummy = 123;
    console.log(`dummy = ${dummy}`);
    var mod = require("esprimaMod");
    

    with 'esprimaMod.js' as :

    function something()
    {
    }
    
    exports.connect = function ()
    {
    	return something;
    };
    

    and the resulting error at line 29 and 42:

    root@ubuntu:~# espruino --verbose --board BANGLEJS2 --config MINIFICATION_LEVEL=ESPRIMA --config MODULE_MINIFICATION_LEVEL=ESPRIMA --config PRETOKENISE=true --config SAVE_ON_SEND=1 --config MODULE_EXTENSIONS=.js --config  MODULE_URL=SmartBracelet/software/modules --minify SmartBracelet/software/projects/esprima.js -o SmartBracelet/software/es.js
    0.1.39
    Espruino Command-line Tool 0.1.39
    -----------------------------------
    
    Acorn library not found - you''ll need it for compiled code
    Found /usr/local/lib/node_modules/espruino/libs/targz.js
    ...
    Initialising CoreModules
    Command-line option set Espruino.Config.MINIFICATION_LEVEL to "ESPRIMA"
    Command-line option set Espruino.Config.MODULE_MINIFICATION_LEVEL to "ESPRIMA"
    Command-line option set Espruino.Config.PRETOKENISE to true
    Command-line option set Espruino.Config.SAVE_ON_SEND to 1
    Command-line option set Espruino.Config.MODULE_EXTENSIONS to ".js"
    Command-line option set Espruino.Config.MODULE_URL to "SmartBracelet/software/modules"
    Explicit board JSON supplied: "BANGLEJS2"
    Loading http://www.espruino.com/json/BANGLEJS2.json
    Board JSON loaded
    Manual board JSON load complete
    No port supplied, but output file listed - not connecting
    Loading modules
    loadModule(esprimaMod)
     - esprimaMod requires []
    Minifyingn esprimaMod
    No errors in esprimaMod. Minified 81 bytes to 66 bytes.
    Minification complete
    Since Acorn 8.0.0, options.ecmaVersion is required.
    Defaulting to 2020, but this will stop working in the future.
    { SyntaxError: Unexpected token (1:54)
        at Parser.pp$5.raise (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:3416:15)
        at Parser.pp.unexpected (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:741:10)
        at Parser.pp.semicolon (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:718:66)
        at Parser.pp$1.parseExpressionStatement (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:1201:10)
        at Parser.pp$1.parseStatement (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:934:26)
        at Parser.pp$1.parseBlock (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:1217:23)
        at Parser.pp$4.parseFunctionBody (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:3242:24)
        at Parser.pp$1.parseFunction (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:1339:10)
        at Parser.pp$4.parseExprAtom (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:2772:19)
        at Parser.pp$4.parseExprSubscripts (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:2583:21) pos: 54, loc: Position { line: 1, column: 54 }, raisedAt: 55 }
    Error parsing JavaScript, but uploading anyway.<br/>SyntaxError: Unexpected token (1:54)
    Minifying
    Error: Line 1: Unexpected token {
    Error: Line 1: Unexpected token {
        at ErrorHandler.constructError (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:5012:22)
        at ErrorHandler.createError (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:5028:27)
        at Parser.unexpectedTokenError (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:1985:39)
        at Parser.throwUnexpectedToken (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:1995:21)
        at Parser.consumeSemicolon (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:2297:23)
        at Parser.parseLabelledStatement (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:4029:19)
        at Parser.parseStatement (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:4122:97)
        at Parser.parseStatementListItem (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:3393:31)
        at Parser.parseFunctionSourceElements (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:4195:29)
        at Parser.parseFunctionExpression (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:4408:26)
    Minification complete
    (node:69905) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected character '«' (1:76)
        at Parser.pp$5.raise (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:3416:15)
        at Parser.pp$9.getTokenFromCode (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:5081:10)
        at Parser.pp$9.readToken (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:4765:17)
        at Parser.pp$9.nextToken (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:4756:17)
        at Parser.pp$9.next (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:4717:10)
        at Parser.pp$9.getToken (/usr/local/lib/node_modules/espruino/node_modules/acorn/dist/acorn.js:4721:10)
        at Object.next (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:115:20)
        at pretokenise (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:164:17)
        at Array.eval (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:31:7)
        at cb (eval at loadJS (/usr/local/lib/node_modules/espruino/index.js:12:11), <anonymous>:98:15)
    (node:69905) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
    (node:69905) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    

    No idea where that 'unexpected token {' would be at in above simple code...

    I honestly thought Espruino Tools used the very same chain of tools as Web IDE does, but apparently this is not the case ? I'm trying to use the tools for distributing an app to multiple Bangle.js 2's, but if Espruino Tools builds 'something different' as compared to Web IDE (where the app was fully debugged), I do not feel particularly comfortable...

About

Avatar for jgw @jgw started