Skip to content

Commit c005d90

Browse files
fix: require Node.js v20+ to resolve 'File is not defined' error
BREAKING CHANGE: Node.js 18.x is no longer supported The undici HTTP client (bundled with cheerio) requires the global File class which is only available in Node.js v20+. This fixes the ReferenceError: File is not defined crash on startup. Changes: - Update engines.node in package.json to >=20.0.0 - Update GitHub Actions CI to test with Node.js 20.0.0 - Update all README files (EN, JA, KR, TW, ZH) with new requirement - Add troubleshooting links in translated READMEs to English docs - Add comprehensive troubleshooting section with: - NVM upgrade instructions (recommended) - NodeSource APT installation (alternative) - Cleanup guide for old Node.js versions - pm2 and systemd service setup (using NVM sourcing for future-proof paths) - Nginx reverse proxy configuration - HTTPS (Let's Encrypt) and authentication setup Fixes #5670
1 parent 69fb14e commit c005d90

7 files changed

Lines changed: 237 additions & 7 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
platform: [ubuntu-latest]
17-
node-version: [18.15.0]
17+
node-version: [20.0.0]
1818
runs-on: ${{ matrix.platform }}
1919
env:
2020
PUPPETEER_SKIP_DOWNLOAD: true

README.md

Lines changed: 223 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ English | [繁體中文](./i18n/README-TW.md) | [简体中文](./i18n/README-ZH.
2424
## 📚 Table of Contents
2525

2626
- [⚡ Quick Start](#-quick-start)
27+
- [Troubleshooting: Node.js Version](#troubleshooting-nodejs-version)
2728
- [🐳 Docker](#-docker)
2829
- [👨‍💻 Developers](#-developers)
2930
- [🌱 Env Variables](#-env-variables)
@@ -36,7 +37,7 @@ English | [繁體中文](./i18n/README-TW.md) | [简体中文](./i18n/README-ZH.
3637

3738
## ⚡Quick Start
3839

39-
Download and Install [NodeJS](https://nodejs.org/en/download) >= 18.15.0
40+
Download and Install [NodeJS](https://nodejs.org/en/download) >= 20.0.0
4041

4142
1. Install Flowise
4243
```bash
@@ -50,6 +51,227 @@ Download and Install [NodeJS](https://nodejs.org/en/download) >= 18.15.0
5051

5152
3. Open [http://localhost:3000](http://localhost:3000)
5253

54+
### Troubleshooting: Node.js Version
55+
56+
If you encounter `ReferenceError: File is not defined` or similar errors, your Node.js version is likely below v20.
57+
58+
<details>
59+
<summary>Upgrade Node.js using NVM (Recommended)</summary>
60+
61+
1. **Install NVM (Node Version Manager)**:
62+
```bash
63+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
64+
source ~/.bashrc
65+
```
66+
67+
2. **Install and use Node.js v20**:
68+
```bash
69+
nvm install 20
70+
nvm use 20
71+
nvm alias default 20
72+
```
73+
74+
3. **Verify installation**:
75+
```bash
76+
node -v
77+
# should show v20.x.x
78+
```
79+
80+
4. **Reinstall Flowise**:
81+
```bash
82+
npm install -g flowise
83+
```
84+
85+
</details>
86+
87+
<details>
88+
<summary>Alternative: Install via NodeSource (APT)</summary>
89+
90+
```bash
91+
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
92+
sudo apt-get install -y nodejs
93+
```
94+
95+
</details>
96+
97+
<details>
98+
<summary>Clean Up Old Node.js Versions (Linux)</summary>
99+
100+
After upgrading via NVM, remove any system-installed Node.js to avoid conflicts:
101+
102+
```bash
103+
sudo apt-get remove --purge nodejs npm
104+
sudo apt-get autoremove
105+
```
106+
107+
Verify NVM's Node is active:
108+
```bash
109+
which node
110+
# Should show: ~/.nvm/versions/node/v20.x.x/bin/node
111+
```
112+
113+
</details>
114+
115+
<details>
116+
<summary>Run Flowise as a Background Service</summary>
117+
118+
#### Option A: Using pm2 (Recommended)
119+
120+
`pm2` is a process manager for Node.js that keeps apps alive and restarts them on failure.
121+
122+
1. **Install pm2**:
123+
```bash
124+
npm install -g pm2
125+
```
126+
127+
2. **Start Flowise**:
128+
```bash
129+
pm2 start "npx flowise start" --name flowise
130+
```
131+
132+
3. **Enable auto-start on reboot**:
133+
```bash
134+
pm2 save
135+
pm2 startup
136+
```
137+
Follow the printed instructions (usually a `sudo` command).
138+
139+
4. **Useful commands**:
140+
```bash
141+
pm2 list # Check status
142+
pm2 logs flowise # View logs
143+
pm2 restart flowise
144+
pm2 stop flowise
145+
```
146+
147+
#### Option B: Using systemd (Native Linux)
148+
149+
1. **Create a systemd service file**:
150+
```bash
151+
sudo nano /etc/systemd/system/flowise.service
152+
```
153+
154+
2. **Add the following** (replace `YOUR_USERNAME` with your actual username):
155+
```ini
156+
[Unit]
157+
Description=Flowise AI Service
158+
After=network.target
159+
160+
[Service]
161+
Type=simple
162+
User=YOUR_USERNAME
163+
WorkingDirectory=/home/YOUR_USERNAME
164+
ExecStart=/bin/bash -c 'export NVM_DIR="/home/YOUR_USERNAME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && npx flowise start'
165+
Restart=always
166+
RestartSec=10
167+
168+
[Install]
169+
WantedBy=multi-user.target
170+
```
171+
172+
3. **Enable and start the service**:
173+
```bash
174+
sudo systemctl daemon-reload
175+
sudo systemctl enable flowise
176+
sudo systemctl start flowise
177+
```
178+
179+
4. **Check status**:
180+
```bash
181+
sudo systemctl status flowise
182+
```
183+
184+
</details>
185+
186+
<details>
187+
<summary>Nginx Reverse Proxy Setup</summary>
188+
189+
Set up Nginx to access Flowise via a custom domain (e.g., `http://flowise.local`).
190+
191+
1. **Install Nginx**:
192+
```bash
193+
sudo apt update && sudo apt install nginx -y
194+
```
195+
196+
2. **Create server block**:
197+
```bash
198+
sudo nano /etc/nginx/sites-available/flowise
199+
```
200+
201+
Add:
202+
```nginx
203+
server {
204+
listen 80;
205+
server_name flowise.local;
206+
207+
location / {
208+
proxy_pass http://localhost:3000;
209+
proxy_http_version 1.1;
210+
proxy_set_header Upgrade $http_upgrade;
211+
proxy_set_header Connection 'upgrade';
212+
proxy_set_header Host $host;
213+
proxy_cache_bypass $http_upgrade;
214+
}
215+
}
216+
```
217+
218+
3. **For local testing**, add to `/etc/hosts`:
219+
```bash
220+
echo "127.0.0.1 flowise.local" | sudo tee -a /etc/hosts
221+
```
222+
223+
4. **Enable and reload**:
224+
```bash
225+
sudo ln -s /etc/nginx/sites-available/flowise /etc/nginx/sites-enabled/
226+
sudo nginx -t
227+
sudo systemctl reload nginx
228+
```
229+
230+
5. **Access**: Open `http://flowise.local`
231+
232+
#### Enable HTTPS with Let's Encrypt
233+
234+
For production with a real domain:
235+
```bash
236+
sudo apt install certbot python3-certbot-nginx -y
237+
sudo certbot --nginx -d flowise.example.com
238+
```
239+
240+
Verify auto-renewal:
241+
```bash
242+
sudo certbot renew --dry-run
243+
```
244+
245+
#### Add Basic Authentication
246+
247+
1. **Create password file**:
248+
```bash
249+
sudo apt install apache2-utils -y
250+
sudo htpasswd -c /etc/nginx/.htpasswd your_username
251+
```
252+
253+
2. **Update Nginx config** — add inside `location / { }`:
254+
```nginx
255+
auth_basic "Restricted Access";
256+
auth_basic_user_file /etc/nginx/.htpasswd;
257+
```
258+
259+
3. **Reload**:
260+
```bash
261+
sudo nginx -t && sudo systemctl reload nginx
262+
```
263+
264+
#### Flowise Built-in Authentication
265+
266+
Alternatively, use Flowise's native auth by setting environment variables:
267+
```bash
268+
# In your .env file or service config
269+
FLOWISE_USERNAME=admin
270+
FLOWISE_PASSWORD=your_secure_password
271+
```
272+
273+
</details>
274+
53275
## 🐳 Docker
54276
55277
### Docker Compose

i18n/README-JA.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
## ⚡ クイックスタート
2121

22-
[NodeJS](https://nodejs.org/en/download) >= 18.15.0 をダウンロードしてインストール
22+
[NodeJS](https://nodejs.org/en/download) >= 20.0.0 をダウンロードしてインストール
23+
24+
> **注意**: Node.js のバージョンに関する問題(`File is not defined` エラーなど)が発生した場合は、[英語 README のトラブルシューティングセクション](../README.md#troubleshooting-nodejs-version)を参照してください。
2325
2426
1. Flowise のインストール
2527
```bash

i18n/README-KR.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
## ⚡빠른 시작 가이드
2121

22-
18.15.0 버전 이상의 [NodeJS](https://nodejs.org/en/download) 다운로드 및 설치
22+
20.0.0 버전 이상의 [NodeJS](https://nodejs.org/en/download) 다운로드 및 설치
23+
24+
> **참고**: Node.js 버전 관련 문제(`File is not defined` 오류 등)가 발생하면 [영어 README의 문제 해결 섹션](../README.md#troubleshooting-nodejs-version)을 참조하세요.
2325
2426
1. Flowise 설치
2527
```bash

i18n/README-TW.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
## ⚡ 快速開始
2121

22-
下載並安裝 [NodeJS](https://nodejs.org/en/download) >= 18.15.0
22+
下載並安裝 [NodeJS](https://nodejs.org/en/download) >= 20.0.0
23+
24+
> **注意**:如果遇到 Node.js 版本相關問題(例如 `File is not defined` 錯誤),請參閱[英文 README 中的疑難排解章節](../README.md#troubleshooting-nodejs-version)
2325
2426
1. 安裝 Flowise
2527
```bash

i18n/README-ZH.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
## ⚡ 快速入门
2121

22-
下载并安装 [NodeJS](https://nodejs.org/en/download) >= 18.15.0
22+
下载并安装 [NodeJS](https://nodejs.org/en/download) >= 20.0.0
23+
24+
> **注意**:如果遇到 Node.js 版本相关问题(例如 `File is not defined` 错误),请参阅[英文 README 中的故障排除章节](../README.md#troubleshooting-nodejs-version)
2325
2426
1. 安装 Flowise
2527
```bash

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
}
9090
},
9191
"engines": {
92-
"node": ">=18.15.0 <19.0.0 || ^20",
92+
"node": ">=20.0.0",
9393
"pnpm": ">=9"
9494
},
9595
"resolutions": {

0 commit comments

Comments
 (0)