• Hello,

    I have just installed the espruino NPM package, and is "partially" working.

    My vital signs are:

    Host Machine
      - Windows 10
      - Node:   8.11.3
      - NPM:    5.6.0
      - Espruino NPM package: 0.1.13
    MCU
      - Espruino WiFi
      - Version:  1v99
    

    I can successfully connect to my Espruino WiFi board, and execute the MCU remotely via the espruino NPM CLI.

    However, I am experiencing a number of very weird run-time errors, when sending code to the board using the espruino NPM package. Things like:

    • Cannot place an "else" clause (of an if/then/else) on a second line. The following run-time error is encountered ONLY when the code is in-line (i.e. the error is not experienced when the code is within a function).

      Uncaught SyntaxError: Got else expected EOF
      at line 2 col 1
      else {
      ^
      
    • Cannot "require" more than one module. When the second module is included, I receive the following run-time error:

      Uncaught ReferenceError: "dModules" is not defined
      at line 1 col 10
      dModules.addCached("TestMod3","print('ex­panding TestMod3.js...
      

    All this code runs correctly, when it is sent via the Espruino IDE. I only have these problems when sending the code using the Espruino NPM package.

    Obviously, something very rudimentary is out-of-whack.

    By enabling verbose output, I have determined that the issue is something related to escape sequences sent to the board, however I do not know how to resolve.

    Sending the following code snippet:

    var x = 1;
    if (x===1) {
      x++;
    }
    else { // CRAZY: can't be on a seperate line (when code is in-line)
      x--;
    }
    

    Sends the following stream:

    Sending...
    ---> "\u0010reset();\n\u0010var x = 1;\n\u0010\u001b[4dif (x===1) {\r\u001b\n  x++;\r\u001b\n}\r\u001b\nelse { // CRAZY: can't be on a seperate line (when code is in-line)\r\u001b\n  x--;\r\u001b\n}\n\u0010\u001b[60dsave()\­n\n"
    

    Generating the following run-time error:

    :else { // CRAZY: can't be on a seperate line (when code is in-line)
    :
    :  x--;
    :
    :}
    Uncaught SyntaxError: Got else expected EOF
     at line 2 col 1
    else { // CRAZY: can't be on a seperate line (when code is i...
    ^
    

    Again, the issue has something to do with the escape sequences, but I do not know how to resolve.

    Your help is greatly appreciated in resolving this issue.

    Kevin

About

Avatar for KevinAst @KevinAst started