[TOC]
according to SillyTavern docs you cannot install SillyTavern on Windows 7 because *it does not support NodeJS 18.16*
![image failed to load](./img/g_ST_on_Win7/intro_ST_docs.png)
let me tell you - {{{S-inline-highlight-red this is a bucking lie /S}}}
in this guide we will install NodeJS 20.0.2 on windows 7, and successfully launch the latest SillyTavern
# NodeJS Windows 7 support
* **NodeJS v13.6.0** - [the very last version that was tested on Windows 7](https://github.com/nodejs/node/issues/33000#issuecomment-617753749). this version can be installed via MSI installer
* **NodeJS v13.7.0 - v.13.14.0** - can be installed and used on Windows 7 as well but they were never properly tested on Windows 7 (still work fine!)
* starting with **NodeJS v14.0.0** - the installation of NodeJs on Windows 7 is no longer available because developers [forcefully blocked installation](https://github.com/nodejs/node/pull/31954) due to "[muh Microsoft no longer supports it](./img/g_ST_on_Win7/updooter.png)". when runtime detects Windows 7 it refuses to work
* **NodeJS v14.5.0** - [added a flag](https://github.com/nodejs/node/pull/33176) `NODE_SKIP_PLATFORM_CHECK` that allows to skip forced OS check, and nodeJS can be **used** on Windows 7 (thank you, community for the started shitstorm!)
* ...but it didn't fix the issue with MSI installer itself! when installing NodeJS via MSI user would get the error message below. but installation via ZIP works fine
```
This application is only supported on Windows 8.1, Windows Server 2012 R2, or higher
```
![image failed to load](./img/g_ST_on_Win7/error_on_install.png)
* **NodeJS v20.3.0** - no longer runs on Windows 7 whether `NODE_SKIP_PLATFORM_CHECK` flag or not. it just shows the error below. in theory it can be fixed by [patching kernel](https://github.com/kernel-extenders/nt61) or by [loading extra DLL](https://github.com/i486/VxKex/) but that's outside of this guide scope
```
The procedure entry point GetSystemTimePreciseAsFileTime could not be located in the dynamic link library KERNEL32.dll.
```
![image failed to load](./img/g_ST_on_Win7/error_on_install2.png)
!!!info so this means **the last version of NodeJS that can be installed in Windows 7 without headache - v20.2.0** (afaik)
# install NodeJS on Windows 7
## uninstall and clean
first of all, if you already tried to install NodeJS on Windows 7 yourself then you *probably* installed it wrong and made a complete mess. before going further, let's clean up and fix possible issues. if you never installed NodeJS before then you may skip this section
1) **delete NodeJS**
go to `Program and Features` -> find Node.js -> uninstall it
![image failed to load](./img/g_ST_on_Win7/clean_deleteNode1.png)
it would be better if you used tools like [Bulk Crap Uninstaller](https://github.com/Klocman/Bulk-Crap-Uninstaller) which can clean up garbage files afterwards, but you do you!
![image failed to load](./img/g_ST_on_Win7/clean_deleteNode2.png)
2) **delete the following folders**:
```
C:\Program Files\nodejs
C:\Users\%your_profile_name%\AppData\Local\npm-cache
C:\Users\%your_profile_name%\AppData\npm
C:\Users\%your_profile_name%\AppData\npm-cache
```
they may contain leftovers and cache, that can mess with new NodeJS install
## download and install
1) download [NodeJS v20.2.0](https://nodejs.org/download/release/v20.2.0/node-v20.2.0-win-x64.zip)
!!!info you need to download **ZIP** (or **7Z**) package and **NOT MSI installer**
2) unpack the archive into the folder
```
C:\Program Files\nodejs
```
![image failed to load](./img/g_ST_on_Win7/unpack_overview.png)
3) the most important part!
open **command-line**: START -> search `cmd` -> right click -> `run as administrator`
use the following two commands in command-line one by one:
```
setx NODE_SKIP_PLATFORM_CHECK 1
setx PATH "C:\Program Files\nodejs;%PATH%"
```
![image failed to load](./img/g_ST_on_Win7/unpack_cmd_flag.png)
first will let NodeJS to be run on Windows 7 (will skip warning message that your system is outdated)
second will register both NodeJS and NPM into OS
if you get the error message
```
Node.js is only supported on Windows 8.1, Windows Server 2012 R2, or higher.
Setting the NODE_SKIP_PLATFORM_CHECK environment variable to 1 skips this check, but Node.js might not execute correctly.
Any issues encountered on unsupported platforms will not be fixed.
```
![image failed to load](./img/g_ST_on_Win7/error_on_flag.png)
then you didn't set `NODE_SKIP_PLATFORM_CHECK` flag (see above)
## verify
1) **close** command-line, and launch it again
2) the following two commands:
```
node -v
npm -v
```
they both check the installed NodeJS and NPM versions. commands must return:
```
node = v20.2.0
npm = v9.6.6
```
![image failed to load](./img/g_ST_on_Win7/unpack_cmd_verify_version.png)
if so then congratulations! you have installed NodeJS on Windows 7!
# installing SillyTavern on Windows 7
## download and install
now lets install SillyTavern itself
1) go to release page and [download ZIP version of SillyTavern v1.12.6](https://github.com/SillyTavern/SillyTavern/releases/tag/1.12.6)
click on button `Source code (zip)` below
![image failed to load](./img/g_ST_on_Win7/ST_zip_download.png)
2) unpack ZIP archive anywhere you want and click on `start.bat` file
![image failed to load](./img/g_ST_on_Win7/ST_bat_start.png)
3) if you did everything right then you will get the error message:
```
code: 'ERR_SYSTEM_ERROR',
info: {
errno: -4054,
code: 'ENOSYS',
message: 'function not implemented',
syscall: 'uv_os_gethostname'
},
errno: [Getter/Setter],
syscall: [Getter/Setter]
```
![image failed to load](./img/g_ST_on_Win7/error_uv_os_gethostname.png)
*do not worry! we will fix it soon*
this error message means that SillyTavern's inner libraries cannot detect what OS you are using: *the libraries use API (commands) that are not available in Windows 7* hence SillyTavern cannot detect OS on start. the are two well-known possible fixes...
## fix for uv_os_gethostname №1
you can install a small tool - **[VxKex](https://github.com/i486/VxKex/)** - that injects into software which doesn't work correctly on Windows 7. it injects extra API and libraries for backward compatibility
1) download [VxKex](https://github.com/i486/VxKex/releases/latest) and install it
2) navigate to where you unpacked NodeJS:
```
C:\Program Files\nodejs
```
3) right-click on `node.exe` -> Properties -> VxKex tab -> 'Enable VxKex for this program' -> Apply
![image failed to load](./img/g_ST_on_Win7/gethostname_fix1_VxKex.png)
4) try to launch SillyTavern now (`start.bat`). it should work fine
![image failed to load](./img/g_ST_on_Win7/works.png)
the downside to this method is that it may be overkill for one small problem
## fix for uv_os_gethostname №2
if you don't want to use [VxKex](#fix_for_uv_os_gethostname_1) then your other option is **[hostname-patcher](https://github.com/Bellisario/hostname-patcher)**
this library can be 'installed' into any NodeJS-based software to patch the `uv_os_gethostname` error
1) open cmd (look above), and run the following command in command-line:
```
npm install hostname-patcher
```
![image failed to load](./img/g_ST_on_Win7/gethostname_fix2_cmd.png)
this will install hostname-patcher globally on your machine, so you will be able to easily add it anywhere you want.
!!!info **very important**
please **use this command twice**:
- first install it, when CMD is launched **with** administrative rights
- second time, when CMD is launched **without** administrative rights
why?
because your account might belong whether *Administrators group* or *Users group*
install it in two different ways to cover both cases
2) now go SillyTavern folder and open file `server.js`
3) find this line at the start of the file:
```
#!/usr/bin/env node
```
right after that line, add two more lines and save your changes:
```
require('hostname-patcher');
const os = require('os');
```
for SillyTavern 1.12.7+ you must use different command:
```
import hostnamePatcher from 'hostname-patcher';
import os from 'os';
```
in default Nodepad it will look like this:
![image failed to load](./img/g_ST_on_Win7/gethostname_fix2_notepad1.png)
...but honestly? [install Notepad++](https://notepad-plus-plus.org/downloads/) and use it instead, far better than default Notepad
![image failed to load](./img/g_ST_on_Win7/gethostname_fix2_notepad2.png)
![image failed to load](./img/g_ST_on_Win7/import_notepad.png)
4) try launching SillyTavern again (`start.bat`). it should work fine
the downside to this method is that if you update SillyTavern, you will need to redo steps (2-3)
5) if you have the following error message:
```
Error: Cannot find module 'hostname-patcher'
Require stack:
at Module._load (node:internal/modules/cjs/loader:923:27
at Module.require (node: internal/modules/cjs/loader:1137:19)
at require (node:internal/modules/helpers:121:18>
at Module._compile (node: internal/modules/cjs/loader:1255:14) at Module_extensions..js (node: internal/modules/cjs/loader:1309:10)
at Module.load (node: internal/modules/cjs/loader: 1113:32) Module._load (node:internal/modules/cjs/loader: 960:12>
at at Function.executeUserEntry Point [as runMain]
in:83:12 ) {
code: 'MODULE_NOT_FOUND',
requireStack:
}
```
![image failed to load](./img/g_ST_on_Win7/gethostname_fix2_error.png)
then read warning above about installing with both administrative and non-administrative rights
6) if you have the following error message:
```
> ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and
'...\SillyTavern-1.12.7\package.json' contains "type": "module". To treat it as a CommonJ5 script,
rename it to use the '.cjs' file extension. at file:.../SillyTavern-1.12.7/server.js:3:1
at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
```
![image failed to load](./img/g_ST_on_Win7/import_error.png)
then use `import` command instead of `require`
***
congrats! you have successfully installed NodeJS 20.2.0 on Windows 7, and you have made it work with SillyTavern!
wasn't too hard, right?