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('expanding 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.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hello,
I have just installed the espruino NPM package, and is "partially" working.
My vital signs are:
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).
Cannot "require" more than one module. When the second module is included, I receive the following run-time error:
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:
Sends the following stream:
Generating the following run-time error:
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