@ECHO OFF REM VERSION SETTINGS REM Normal: set version=latest REM selected Version : set %version%=@ set version=latest set curpath=%cd% echo ******************************************************************** echo * NODE RED Installation LOCAL (Windows) V1.0 * echo *------------------------------------------------------------------* echo * requires NodeJS installed * echo * requires npm to be available from any directory (PATH variables) * echo * in case of questions: [place NPM mailbox here] * echo * author: LOSTBITS * echo ******************************************************************** echo Starting NodeRED Installation in Path: %curpath% echo :startInstall set answer=n/a set /p answer=Do you want to install a fresh version of NodeRed? [Y = Start/N = Quit] echo %answer% if /I %answer% EQU N goto :no if /I %answer% EQU Y goto :installNodeRed goto startInstall REM Output for Aborting the installation :no echo Aborting install goto :ende :installNodeRed echo Start NodeRED installation... echo disabling strict SSL call npm set strict-ssl false echo disabling GYP SSL SET NODE_TLS_REJECT_UNAUTHORIZED=0 echo Setting Proxy fix (Self signed certificate fix) call npm config set registry http://registry.npmjs.org echo Installing Modules... timeout /T 10 /nobreak call npm install -safe --prefix %cd% node-red@%version% echo Please Check Version of NodeRED - if wrong version, please change %version% in this file :startNodes set answer=n/a set /p answer=Do you want to install core Nodes (core.nodes)? [Y = Start/N = Stop] echo %answer% if /I %answer% EQU N goto :ende if /I %answer% EQU Y goto :installCore goto :startNodes :installCore echo Scanning core.nodes and launching install timeout /T 10 /nobreak for /F "tokens=1" %%i in (core.nodes) do call :process %%i %%j %%k goto :installAdditional :process set VAR1=%1 call npm install -safe --prefix %cd% %1 echo core.node [%1] installed. check for errors. Next node will start after timeout. timeout /T 10 /nobreak goto :EOF :installAdditional set answer=n/a set /p answer=Do you want to install AddOn Nodes (addon.nodes)? [Y = Start/N = Stop] echo %answer% if /I %answer% EQU N goto :ende if /I %answer% EQU Y goto :installAddOns goto :installAdditional :installAddOns echo Scanning addon.nodes and launching install timeout /T 10 /nobreak for /F "tokens=1" %%i in (addon.nodes) do call :process %%i %%j %%k goto :finishInstall :process set VAR1=%1 call npm install -safe --prefix %cd% %1 echo core.node [%1] installed. check for errors. Next node will start after timeout. timeout /T 10 /nobreak goto :EOF pause :finishInstall ECHO Last step is modification of settings file for node red ECHO Modifying location REM We need to append the home dir to the current dir (since it must be in the settings.js) set NodeREDHomePathWinDir=%cd%\node-red_home set NodeREDNodesPathWinDir=%cd%\node_modules REM and we need to replace '\' by '\\' in the dirs due to java conventions SET NodeREDHomePathJavaDir=%NodeREDHomePathWinDir:\=\\% SET NodeREDNodesPathJavaDir=%NodeREDNodesPathWinDir:\=\\% ECHO HomePath is [%NodeREDHomePathJavaDir%] ECHO NodePath is [%NodeREDNodesPathJavaDir%] set NodeREDPort=1880 set /p NodeREDPort=Using Port %NodeREDPort%? [ENTER=OK/any number between 1 and 65535 to choose another port] echo configuring NodeRED for port %NodeREDPort% powershell -Command "(gc %cd%\node-red_home\settings.js.template) -replace '@dir@', '%NodeREDHomePathJavaDir%' | Out-File -encoding ASCII %cd%\node-red_home\settings.js.port" powershell -Command "(gc %cd%\node-red_home\settings.js.port) -replace '@port@', '%NodeREDPort%' | Out-File -encoding ASCII %cd%\node-red_home\settings.js.nodes" powershell -Command "(gc %cd%\node-red_home\settings.js.nodes) -replace '@nodesdir@', '%NodeREDNodesPathJavaDir%' | Out-File -encoding ASCII %cd%\node-red_home\settings.js" echo Fixing start batch file powershell -Command "(gc %cd%\startnodered.cmd.template) -replace '@dir@', '%NodeREDHomePathJavaDir%' | Out-File -encoding ASCII %cd%\startnodered.cmd" :thenextstep Echo installation finished. Scroll up to see erros pause TODO: Fix Start Bat TODO: Fix Settings.JS :ende echo finish pause