How to install nodejs and node red together using a batch file in Windows

  • 1 year ago
Comment

ChatGPTChatGPT
1 / 1

To install Node.js and Node-RED together using a batch file in Windows, you can follow these steps:

  1. Download Node.js installer:

  2. Create a batch file:

    • Open a text editor (e.g., Notepad) and create a new file.
    • Copy and paste the following commands into the file:
    batch
    @echo off

    REM Install Node.js
    echo Installing Node.js...
    msiexec /i <path-to-nodejs-installer.msi> /qn

    REM Install Node-RED
    echo Installing Node-RED...
    npm install -g --unsafe-perm node-red

    REM Start Node-RED
    echo Starting Node-RED...
    node-red
    • Replace <path-to-nodejs-installer.msi> with the actual path to the Node.js installer you downloaded in step 1.
  3. Save the file with a .bat extension (e.g., install_node_red.bat).

  4. Run the batch file:

    • Double-click on the batch file (install_node_red.bat) to run it.
    • The script will first install Node.js using the provided installer, then install Node-RED using npm, and finally start Node-RED.

Note: Make sure you have administrative privileges on your Windows machine to install software and modify system paths.

After running the batch file, you should have Node.js and Node-RED installed on your system, and Node-RED should be running. You can access the Node-RED web interface by opening a browser and navigating to http://localhost:1880.