How to start a node.js script without command line?

Hi there! :slight_smile:
I have a Node.js script that I would like to begin running on the website I pay for. (The script will run ad infinitum as it reacts to events and performs actions based off of input.)

On my dev machine I simply open up the command line and run the command node \path\to\script\[SCRIPT_NAME].js. Everything works great!

However, due to the type of hosting I pay for, on my production server I do not have command line or SSH access. I can only upload/remove files via FTP and install Wordpress. So I can upload my script files to the server… but then I don’t know how to begin running it.

How do I start the script running without command line access or being able to click it as an executable?

You can easily upload an index.html file which is doing nothing else then importing the js script

<!DOCTYPE html>
    <script type="javascript" src="yourscriptname.js"></script>


Then you can start the script by calling index.html

Of course when you close your browser the script will stop.
But there is no other way to run a script on a standard web page provider.

Oh, great! Then all I have to do is visit that page for the script to run? Will the Node script continue to run even when I navigate away from that page in my browser?

Sorry my edit was too late.

No there is no way that your script runs independently. For that you need a real virtual sever package and not a web page package

Okay, that’s a real bummer! Thank you for that information!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.