Espruino NPM CLI Issue in Sending Code to Board #1001
Replies: 8 comments
-
Posted at 2018-10-16 by @gfwilliams Can you try updating the NPM package? It seems it was a little bit behind the IDE (I've just published a new version) and a bug had got introduced to do with the line numbering a while back. I just tried the code you posted here with the new version and it seems to work ok. It's worth noting that if you paste the IF statement you've shown on the left-hand side of the IDE (or in interactive mode using the CLI) then it'll still fail with the same error - because when you hit 'enter' before the When working correctly the CLI tries to detect code like that and rewrites the Carriage Return as a different set of characters which tells Espruino to add a newline but without executing. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-10-16 by KevinAst @gordon: Thanks for you quick reply. I was out-of-the-office for a bit, hence this delayed response. Per you request, I updated the espruino package to
My full code can be found here:
Here are some points of interest and/or questions:
Your help is greatly appreciated. Kevin> Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-10-17 by @gfwilliams
Yes, it should be the same. In fact I just tried here with your job file and it works great for me. I think the problem is with Windows line endings in your text files? Could you check?
Yes, that's correct. Espruino Bracket counts to see if a command is finished or not. This might be some help: http://www.espruino.com/Troubleshooting#i-ve-pasted-code-into-the-left-hand-side-of-the-web-ide-and-it-doesn-t-work
Yes, that works fine. Or you could format your code differently, or just save it in a Unix file format for now :)
No... The issue is that if Espruino did that, it'd have to have your entire source file in RAM at once. People routinely upload code files that are themselves bigger than Espruino's available RAM, and the only way it can handle that is by executing each individual command/declaration as it comes in. Assuming it really is windows line endings in your file, it should be trivial to make the CLI work around it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-10-17 by KevinAst Thanks for the info @gordon. I had suspected windows cr/lf was the culprit, but was unfamiliar with all the special processing done by espruino. The difference in my new process is it is being checked into a git repository, and I think git is attempting some "neutral" representation of cr/lf. I can research some git settings. With that said, however I believe all my production code will be contained inside function definitions, so I should be OK. Thanks for your help and insight. Kevin |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-10-17 by @gfwilliams No problem. I'll file an issue about this and see what I can do in the CLI itself. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-10-17 by @gfwilliams If you update from NPM now it should work :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-10-17 by KevinAst I upgraded to espruino@0.1.15 and it appears to now support windows-based cr/lf. Thanks! BTW: Do you maintain any revision history for the espruino package releases? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-10-18 by @gfwilliams No, I don't maintain any history for the CLI tools/Web IDE I'm afraid - just for Espruino itself, which is at https://github.com/espruino/Espruino/blob/master/ChangeLog |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-10-16 by KevinAst
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
Beta Was this translation helpful? Give feedback.
All reactions