How to run in local server?



  • In brackets I can run P5js code in my local Chrome, I’m presented with the option of setting this as shown in the attached image. Is there a way to do this is nppp? If I run them in Chrome from nppp they hang. Am I missing something?

    Screenshot (213).png



  • @Geo-Meadows ,

    When you view an HTML file in the browser (launched from Notepad++), it just opens that one file in the browser. I don’t know whether your “P5js code” is just the javascript source code, or also has HTML wrapping it. If there is HTML, then depending on how your relative links are set up, maybe it’s not pointing correctly with the file:///-equivalent URLs as it would if you were running it from a server (where / would refer to the root of the webserver, rather than your main folder, presumably on your c:\ drive, so looking for /blah.js would be trying to link to c:\blah.js , rather than some file relative to your main index.html or equivalent.)

    But really, we cannot tell, because we don’t know what you’re really trying to do, and you didn’t give us much to go on.

    Moreover, based on your brief description, I don’t think the answer would be any different if you use Notepad++ to send file x.html to Chrome compared to using Windows Explorer to send file x.html to Chrome, or using Chrome to open local file x.html. If there isn’t a difference between opening it those three ways, then the problem is in your HTML/JS/P5JS, not in Notepad++ itself – and thus the question isn’t really on-topic for a Notepad+±specific forum. If there is a difference between those three ways, you’ll have to give us more to help you with, because right now, you haven’t described your problem with enough detail.



  • Thanks for the reply @PeterJones
    Yes the .js code is in an index.html wrapper, should have said of course. I have a whole range of index.html files that perform the same. If I run in Chrome from nppp it’s the same as double clicking the html file in Win10 file explorer, they open in a new tab in Chrome (or Firefox - the same result) but hang ‘loading’, waiting in vain for the server to serve a required local resource I assume. The url shown is, as an example,
    file:///D:/Dropbox/P5js/clickDoorbell/index.html
    If I launch any of these html files from Brackets editor they open in a NEW Chrome window and run perfectly. In this example case the Chrome url is
    http://127.0.0.1:57542/clickDoorbell/index.html



  • @Geo-Meadows ,

    The problem is not with Notepad++. The problem is that when you run from “Brackets”, whatever that is, it is starting a web server on your local machine with port 57542, so it’s acting like a real web server. When you launch from Notepad++, or from Windows Explorer, Chrome is just opening up a local copy of the file without any web server software being run.

    If you can figure out an executable command-line that can be run that’s equivalent to what “Brackets” is doing behind-the-scenes, then that command-line can be run from the Notepad++ Run > Run dialog… but without that command line, there’s nothing we can do to help you, because the problem is not with Notepad++ itself.



  • @PeterJones Many thanks for info. I’ll look into the command line approach.

    btw Brackets is an editor very like nppp but being phased out so I’ve been trying NPpp and Visual Studio as replacements. VS has precisely the same issue regarding using a local server as NPpp!


Log in to reply