Placing module code in local modules folder doesn't appear to be located by Native IDE #6128
Replies: 1 comment
-
Posted at 2018-09-10 by @allObjects @robin, it looks like your sandbox is not really set... because it goes obviously only for remote... I know that in Win (and depending on settings on Mac) upper/lower may or may not matter... so checking for casing is good. It matters where you store the modules, but only relative to the setting of the sandbox. If the IDE settings for sandbox is C:\esp\_sbx then the modules folder has to be at C:\esp\_sbx\modules In other words, modules locally are always found in modules folder in sandbox folder, and of course, the module has to have an extension that shows in the list in the settings. That your module is not found at espruino.com/modules - hence the 404 - is obvious, but that it does then not find it in local - assuming the settings are correct and match the directory path of the modules - is not known to me... Btw, I'm not sure about forwards slash (/) and backward slash - backslash () for modules separator... What are your settings of:
What is your internet connection? - mobile (Phone Data, G?) or other? What is your sandbox folder hierarchy? What is running on your Win machine while you are uploading? What kind of firewall / antivirus / protection do you have running on your machine? What is the accesscontrol of the sandbox and its contained modules folder? @gfwilliams, is there a way to dump the Espruino IDE config as a JSON string? Posted at 2018-09-10 by Robin Mon 2018.09.10 @allObjects, I verified the placement of the \modules folder and that your testLED.js file was there. Install defaults for sandbox location:
Note: That this forum post page omits the backslash before the '_sbx' folder and in 'projects' folder below - it's there in both places, just checked As per the Modules page ref #1 above, There is also a child modules folder
and yes, placed a copy of the file there also. The install defaults for Settings >> Communication:
backslash is before '_sbx' also I have administrator rights set for the access control, so that shouldn't be an issue Gordon indicated he was on Holiday this week so, we'll wait to see whether the config can be dumped before I tackle more. Posted at 2018-09-11 by Wilberforce Hi @robin This what is working under windows 10 for me: (native Web IDE version 0.69.0) Settings->Project
code:
And on send :
I have noted on startup of the ide that sometimes do you need set the project sandbox on startup, as this seems to get forgotten and needs to be re-selected. Looking at the settings->Console These are at the relevant bits I see:
Posted at 2018-09-11 by @allObjects @robin, the sequence of backslash has a special meaning to the forum... and therefore does not show. I got it rendered by placing two (2) backslashes in... ;-) Posted at 2018-09-12 by Robin Tue 2018.09.11 Thank you @wilberforce, the extra set of eyes helps. Along with the folder hierarchy confirmation.
@allObjects, found that tidbit
IMHO: then having default folders with leading underscore is not only confusing in file structure to the end user, this forum machine also struggles. So why not eliminate it in future releases? (Unless of course Mac's use that convention) While pouring over many console logs over the last three days . . . . and, . . . this will explain it all . . . . Review line #5#6 of console output from #1 above. Go on, . . . I'll wait while you take a peek . . . . Got it? You did look didn't you? . . . go on scroll up, . . . I'll wait I said this would explain it. So here goes . . .
John Cleese as barister - flowing robe and wig okay, let me get the accent right . . . lights, camera, and . . . action JC: How may I help you madame? JC: Yes, yes we have. JC: We've run into a bit of a snafu, you see . . . EI: Well, where is it? JC: You see madame, it took a bit longer than expected, 250msec to be exact!! JC: We don't handle that. [long dramatic pause] EI: What, you don't handle bringing me, my module you found? run laughter track curtains close, Liberty Bell music sounds in background . . . and cut! That's a wrap!! So, surprisingly we all missed it! While looking for folder mapping concerns, the answer was there right in front of us. Posted at 2018-09-12 by @allObjects 404 is totally correct... it could not find it locally and so it looked remote, and there - espruino.com - it could find it. If local was emulated with something else that is not able to deliver a handful bytes within 250ms something else in the system setup is amiss. In some environments that are slow to connect, connecting first before hitting the upload button does the trick... even though upload can connect on demand... but the timeout then obviously hits... @gfwilliams mentioned more recent somewhere - if I'm remembering correctly - that (module?) upload(?) code is (was?) a bit iffy and would need (some) rewrite...
This is only because using the same set of terminals for different purposes... or mixing two langages - one content and the other rendering - that use the same set of symbols... to avoid people having to use real markup... in a plain-text editor (basics of (markup) language design / compiler/interpreter construction). So saving in one corner with a cheap markup is will make paying in a corner somewhere else... On the other hand, not only what's going on in this forum but also on all wiki pages and even in yaml files, it can work and is a great relieve over known constructs, such JSON, HTML, and even more so for the dead XHTML and the still vividly alive XML. XML (w/ schemas and other supporting mechanisms will not go away, because that is the ultimate solution to prevent misunderstandings / mixups, or in other words, be as clear and precise as possible to communicate what has to communicated). When entering the paths, I right away noticed that something was fishy and I doubted first myself that I missed the backslash... but that was quickly verified and resolved. Another reason why it is perfectly acceptable to use this simple, same symbols markup without reserved begin and end character, the forum already provides inline and in block escape - shift in a different rendering mode and shift out again - with beginning and ending tripple-back-ticks... the way we show and share /copy-paste to and from code blocks, where we for sure cannot accept character swallowing... (only one little problem: using this forum for python multi-line string... luckily, JavaScript picked the single back tick for that and is safe ;-) Posted at 2018-09-12 by @gfwilliams So what machine/OS are you actually using the Espruino IDE on? Just a bit of background - the current project sandbox code calls into Chrome to try and find the file on the disc. If the file doesn't exist then it never actually gets a callback, so it has a timeout instead to figure out if the file is missing. If that timeout is raised, it slows down the upload of all modules that aren't on the hard disk for every user so it's a tradeoff. I had (perhaps wrongly) assumed that a computer from the last 10 years might be able to retrieve a file from the hard disk in under a quarter of a second given mine seem to manage it in a few thousandths of a second, but obviously that was too optimistic. Perhaps you have a virus checker enabled that's drastically slowing file accesses down? Posted at 2018-09-12 by Robin Wed 2018.09.12
As I read the following:
Line 5 Is the request to load the module named 'testLED' So, I disagree with the assessment the local file could not be found as the error log shows.
The same as always, I only have one, a recent HP Notebook laptop running Windows 10 Posted at 2018-09-13 by Wilberforce Perhaps a solution would be here at this point, as well as setting the found flag, clear the timer? Posted at 2018-09-13 by @allObjects Browsed the code and noticed this line
in (private) function How does the IDE user experience this limit? For, example, if the directory has more than 100 entries, will only the first 100 be considered / processed / shown? Posted at 2018-09-18 by @gfwilliams @robin did you try disabling the virus checker and seeing if that helps?
As I said in the post (and it says in the console log), the file does exist - it's the time taken to access the file that is the issue.
Yes - personally it seems to me like that code could be improved a lot though. For instance in that function it should know if a file isn't found. If that is the case then potentially the timeout could be removed completely.
No - because that extra line of code by the comment reads the next 100, and so on. Posted at 2018-09-18 by @allObjects
@gfwilliams, good to get confirmed... did actually not expect to find a limitation in the code with no mentioning in any of the documentation. I'm not sure I ever had 100+ files in one of the directories, but a lot for sure. Posted at 2018-09-18 by Robin Tue 2018.09.18
Yes. Disabled Avast and ran the test again, but had the same output as above #9 Posted at 2018-10-06 by Robin Sat 2018.10.06 Recently installed the new IDE 0.70.4 and thought I'd give this another try, but now in a separate new folder in the root of the drive, to avoid folder inheritance issues. I'm on the same laptop PC with no SD card feature, so am puzzled by yet a new error:
Even more puzzling, I didn't create, nor is there when using the 'Projects' button,
Not had to do this after checking each time is still intact on IDE start. Posted at 2018-10-06 by Robin Sun 2018.10.07 Restarting and recreating a new folder in the HD root, away from the Windows 'Documents' folder, . . . . and . . . . After realizing that deployed to GitHub modules require the filename, local folders require just the module name. Finally was able to read a local module! It is the 'tilde' that precedes the relative folder path that needs attention when selecting the folder for the sandbox. What the IDE doesn't do well is when creating a folder within the 'Projects' folder to store multiple files related to the same project, locating that module. So maybe relative pathing needs review? Also, when I deleted the module, the IDE still ran as if the module was still present. So a caching issue or Windows? Rebooting solved that. Posted at 2018-10-08 by @gfwilliams Ok, glad you got it working. Where was the
This is coming from Espruino itself. By the look of the use of Posted at 2018-10-08 by @allObjects *This post needs some more EDIT - so take it with a pinch of salt, because it does not include all the aspects a sandbox serves... :( * - aka: ...if I would have more time, I would have written a shorter letter (post)... @robin, indeed, I would like to have stronger code / library organization options, like projects would include subfolder - for each project one - and - related to that project - a folder just for the project specific modules. The general modules folder would always be available. But last sentence in previous paragraph kind-a invalidates the first one, because it becomes a never ending rabbit trail: when do you decide a module becomes generally available or stays within a project specific modules folder... After all the, the IDE is a free-be, to make things easy. For me it boils down to a sandbox per real project, that gives the extra level to have project specifics going very well, since the sandbox name can be chosen. What I'm now missing with this sandbox being a project, where can I put modules across my projects? My answer is: if they are of that sort, grow them to general purpose AND general PUBLIC use, make a merge request and they are in the espruino.com/modules folder on the Web for the BENEFIT of ALL. If that is too course granular, yes, a local extra configurable folder for shared folders folders across sandboxes would be the perfect solution... kind-a the same as 'requested' in the very first sentence of this post for all users that like more control over library structuring locally, but made much simpler to implement when thinking of the sandbox is the project. Modules would then - depending the configuration - searched first locally in the modules folder, then - again locally - in the shared modules folder - and then in the - espruino.com/modules folder. This configuration can become a bit tricky when the existing of a non-minified should be found first even though a minified version exists in a different precedence / sequence. It is though something to think about. (Naming should then be a bit different in the end with sandbox being project folder, project folder being main (level 0, or a like, and would most of the time include only one file, since after all, only one main can run on the mc and mains are not switched or chained, even though they can when stored on sd card using some RYO code), modules keep their name, and an additional - shared modules is chosen - ...)... and again, tripping over my own (thought) feet... Posted at 2018-10-09 by Robin Mon 2018.10.08
From #16
The key "when selecting the folder for the sandbox" *Settings >> Project >> Select Directory for Sandbox* I drilled down until
and the IDE modal window then displays the relative path in the edit field
This is what Windows/WebIDE assigns, not user input. I'm now using
and the sandbox functionality worked. But now have the nuisance of adding yet another folder to my list of backups, exactly opposite of what the 'Documents' folder concept was supposed to prevent. :-)
That may be what the output is revealing, but it isn't what I was doing. If #15 is re-read, all I did was add the code file to the projects folder and the module to the modules folder. When I clicked on the 'Projects' button and selected the code file, upload, that error verbatim is revealed. That is why I indicated it was puzzling as it is nothing I intended or attempted. This laptop doesn't even have an SD card option. and, a fresh install IDE 0.70.4 Wow Google is impressive. Found those source files in one search attempt, when I could only remember that I actually did create them, but when? What @allObjects created to test the module concept:
Those two short files used verbatim and caused the output as in #15 and ref #17 I used those as allObjects had created and tested. Posted at 2018-10-09 by @allObjects ...any ...x - linux and unix have a fight with any win / ms... or vice versa. More the latter, because the
Unfortunately, win has multiple homes, so it does not really know where home is... it is different for different file types (or content types)... a simplification and one less path switch for win users, but a total loss - not win - for everything else in win. (last but not least, this is historically, because win came out of a single user, stand alone system... where as linux / unix was built multi-user from the beginning... and not only that, multi-user, multi access level (user, group, world). Win has somehow caught up with that during its life time. Bringing both in sync and hide the differences where they do not - and more so - should really matter - aka Espruino - is not a simple task... Especially in the browser, that should not expose anything about the underlaying world. Posted at 2019-01-23 by Robin Tue 2019.01.22 Hi gang, hate to reopen old wounds, but this issue has re-surfaced. recap: Put coding on the back burner in November. Started back up a week ago. With nothing more than the passage of time, again, I'm now not able to load modules. > dup lines removed for brevity and 404 url is truncated
What changed on my PC on this end?
What changed on the WebIDE and server side? I notice (what appears new) that the phrase 'Splitting for Modules.addCached, delay 250' was added EDIT: Per #8 above, I disabled Avast shield control for the default ten minutes, and was able to proceed, so far two attempts. This extra step in annoying, especially when making many changes and needing the extra step to canvas the web for supporting reference docs. Will update here only if the problem persists.
Posted at 2019-01-23 by @gfwilliams
Nothing at all to do with projects has changed. This is 100% something that has changed on your PC. As far as I'm aware you are basically the only user that's hitting this out of thousands of Web IDE users. While someone could possibly rewrite the way 'projects' handles loading files the whole situation is a bit of a mess with Projects only working on Chrome apps (and windows native), which is deprecated and disappearing soon anyway. At some point I'd like to add an online element to the IDE that'd just pull files from a user account Honestly all I can suggest is to put your modules online or on a local webserver and instead require them via URL. Or is defragmentation still a thing on your PC? If so, I'd do that - it might be that just having a less fragmented hard disk would speed up the access time and would fix your problems. Failing that - time to upgrade to an SSD? Posted at 2019-01-23 by Robin Wed 2019.01.23
It would be interesting to know how many of those individuals are developing modules that have at least 30K byte source file size. Or for that matter how many even develop modules. My guess is only a handful.
Nice if they didn't need development. Trying to develop smaller functions using the IDE editor, then move them to the module. That would reduce the need to upload to a remote server, each time to test.
Out of the two users I know have a 1T SSD, one failed losing everything, just after six months of use. At a 50% failure rate (of those I know), I'll hold off for a bit. But a PC is in the budget for later this year. Posted at 2019-01-23 by @gfwilliams Maybe try a webserver on your local PC? It can then directly serve up the files you're developing in whatever IDE you want - so no upload/copy needed. SSDs may very occasionally fail and lose everything, but so do hard disks - I believe far more often than SSDs. Even with RAID computers get stolen, dropped, accidentally formatted, etc too - you need backups regardless of the storage you're using. Posted at 2019-01-23 by Robin
I have xampp already installed, so I'll try that. It's a constant battle trying to decide which balance of time use will work in the long run, e.g. remote GitHub vs local server vs close and re-open IDE. Living with the sequence in Edit 2 of #21 for now, as opposed to file copying test modules to the xampp file structure or u/l to GitHub. > ' but so do hard disks' (fail) From twenty to ten years ago, I've personally had two Western Digital and one Seagate go the dreadful 'Click' death, along with a Dell laptop five years ago. For full size HD's, get near or above (twenty yr ago rating method) the 10,000 hr MTBF mileage, but for laptops, only 5000 hrs of use. The reason for a laptop purchase (which most likely will be SSD) (I'm at 3000 now) on the horizon. ;-)
Interesting read: > https://www.wepc.com/tips/ssd-reliability/ Mfg MTBF is now a cumulative (as I was curious why figures are now ten+ times higher) reported figure, and SSD's close to HD this day and age. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-09-09 by Robin
Sun 2018.09.09
Commented on in a separate link but burried by title, so relisted here for more current visibility.
From: https://www.espruino.com/Modules
Located the default projects file newProject.js and verified the module file was in an adjacent sister folder.
Ran the app but was greeted with: Module testLED not found
The console output appears to agree that the modules folder isn't being searched.
I also found this reference form Mar 2018 with similar situation and apparent attempt to resolve. Does this need a revisit?
http://forum.espruino.com/comments/14110348/
WinXP: how can I require() some locally held modules?
espruino/EspruinoWebIDE#186
Beta Was this translation helpful? Give feedback.
All reactions