1.0.11 • Public • Published


    This script wraps a call to node in such a way that the commandline window is hidden. It uses vbscript approach similar to this, and only works on Windows OS. Any number of arguments can be passed to the script.


    The module is intended to be installed globally:

    npm install -g runbg



    Use like you normally would use node but type nodebg instead. Say you have a script test_server.js (check runbg module directory) that you want to run with a port number as an argument:

    nodebg test_server 8000
    PID: 4340

    The PID of the started process gets printed to the commandline if everything is ok. Now the console window in which you have typed the command can be closed. Test wether the server is running by typing http://localhost:8000/ in browser. The server can then be stopped by killing node process with the corresponding PID in taskmanager or by command:

    taskkill /PID 4340 /F

    Note that if some server on the port specified is already running this won't stop new node process from being created, so nodebg test_server 8000 if ran multiple times in a row will always print new PIDs as it should. But the node process will crash due to port 8000 being occupied already. So new processes will be terminated immediately after creation and only the first server will keep running.


    Runbg is a more generic version of 'nodebg' script that allows to run any commandline application in the background:

    runbg node test_server 8000 some_other_argument

    Check for process.Create errorcodes explanation.


    npm i runbg

    DownloadsWeekly Downloads






    Last publish


    • grabantot