-
-
Notifications
You must be signed in to change notification settings - Fork 23.6k
fix: require Node.js v20+ to resolve 'File is not defined' error #5672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: require Node.js v20+ to resolve 'File is not defined' error #5672
Conversation
Summary of ChangesHello @vellanki-santhosh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical runtime error by enforcing a higher Node.js version requirement, specifically Node.js v20 or later. It significantly enhances the project's documentation to guide users through the necessary environment setup, including detailed instructions for upgrading Node.js and configuring various deployment scenarios like background services, reverse proxies, and authentication. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly addresses the File is not defined error by enforcing Node.js v20+, which is a necessary breaking change. The accompanying documentation updates are thorough and very helpful for users, especially the new troubleshooting section in the main README.md.
My review includes a suggestion to improve the robustness of the provided systemd service configuration by removing a hardcoded Node.js version. Additionally, to improve the experience for non-English speaking users, I've recommended adding links in the translated README files that point to the detailed troubleshooting guide in the English version. Overall, this is a great contribution that will resolve a critical startup issue for many users.
README.md
Outdated
| Environment="PATH=/home/YOUR_USERNAME/.nvm/versions/node/v20.18.0/bin:/usr/bin:/bin" | ||
| ExecStart=/home/YOUR_USERNAME/.nvm/versions/node/v20.18.0/bin/npx flowise start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The systemd service file hardcodes a specific Node.js version (v20.18.0) in Environment and ExecStart. This is brittle and will fail if a user has a different patch version of Node.js installed via nvm. It also requires manual updates to the service file whenever Node.js is updated.
A more robust approach is to remove the hardcoded paths and use nvm within the service to manage the Node.js environment. This makes the service file independent of the specific patch version.
I suggest replacing the Environment and ExecStart lines with a single ExecStart that sources the nvm.sh script. This will use the default Node.js version configured with nvm, which the user is instructed to set to v20 earlier in the documentation.
| Environment="PATH=/home/YOUR_USERNAME/.nvm/versions/node/v20.18.0/bin:/usr/bin:/bin" | |
| ExecStart=/home/YOUR_USERNAME/.nvm/versions/node/v20.18.0/bin/npx flowise start | |
| ExecStart=/bin/bash -c 'export NVM_DIR="/home/YOUR_USERNAME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && npx flowise start' |
| ## ⚡ クイックスタート | ||
|
|
||
| [NodeJS](https://nodejs.org/en/download) >= 18.15.0 をダウンロードしてインストール | ||
| [NodeJS](https://nodejs.org/en/download) >= 20.0.0 をダウンロードしてインストール |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the Node.js version requirement has been updated, the detailed troubleshooting guide from the English README.md is missing. To help users who might face issues with upgrading Node.js, it would be beneficial to add a link to the troubleshooting section in the main README.md.
| [NodeJS](https://nodejs.org/en/download) >= 20.0.0 をダウンロードしてインストール | |
| [NodeJS](https://nodejs.org/en/download) >= 20.0.0 をダウンロードしてインストール | |
| Node.js のバージョンに関する問題が発生した場合は、[英語の README にあるトラブルシューティングのセクション](../README.md#troubleshooting-nodejs-version) を参照してください。 |
| ## ⚡빠른 시작 가이드 | ||
|
|
||
| 18.15.0 버전 이상의 [NodeJS](https://nodejs.org/en/download) 다운로드 및 설치 | ||
| 20.0.0 버전 이상의 [NodeJS](https://nodejs.org/en/download) 다운로드 및 설치 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the Node.js version requirement has been updated, the detailed troubleshooting guide from the English README.md is missing. To help users who might face issues with upgrading Node.js, it would be beneficial to add a link to the troubleshooting section in the main README.md.
| 20.0.0 버전 이상의 [NodeJS](https://nodejs.org/en/download) 다운로드 및 설치 | |
| 20.0.0 버전 이상의 [NodeJS](https://nodejs.org/en/download) 다운로드 및 설치 | |
| Node.js 버전 관련 문제가 발생하면 [영어 README의 문제 해결 섹션](../README.md#troubleshooting-nodejs-version)을 참조하세요. |
| ## ⚡ 快速開始 | ||
|
|
||
| 下載並安裝 [NodeJS](https://nodejs.org/en/download) >= 18.15.0 | ||
| 下載並安裝 [NodeJS](https://nodejs.org/en/download) >= 20.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the Node.js version requirement has been updated, the detailed troubleshooting guide from the English README.md is missing. To help users who might face issues with upgrading Node.js, it would be beneficial to add a link to the troubleshooting section in the main README.md.
| 下載並安裝 [NodeJS](https://nodejs.org/en/download) >= 20.0.0 | |
| 下載並安裝 [NodeJS](https://nodejs.org/en/download) >= 20.0.0 | |
| 如果遇到 Node.js 版本問題,請參閱[英文版 README 的故障排除部分](../README.md#troubleshooting-nodejs-version)。 |
| ## ⚡ 快速入门 | ||
|
|
||
| 下载并安装 [NodeJS](https://nodejs.org/en/download) >= 18.15.0 | ||
| 下载并安装 [NodeJS](https://nodejs.org/en/download) >= 20.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the Node.js version requirement has been updated, the detailed troubleshooting guide from the English README.md is missing. To help users who might face issues with upgrading Node.js, it would be beneficial to add a link to the troubleshooting section in the main README.md.
| 下载并安装 [NodeJS](https://nodejs.org/en/download) >= 20.0.0 | |
| 下载并安装 [NodeJS](https://nodejs.org/en/download) >= 20.0.0 | |
| 如果遇到 Node.js 版本问题,请参阅[英文版 README 的故障排除部分](../README.md#troubleshooting-nodejs-version)。 |
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 FlowiseAI#5670
e57e0aa to
c005d90
Compare
|
PR Review Responses Systemd Service File
Translated README Files
Testing Confirmation
Final Note
|
Summary
Fixes #5670 - Starting a local server fails with
ReferenceError: File is not definedRoot Cause
The
undiciHTTP client (bundled withcheerio) requires the globalFileclass, which is only available in Node.js v20+. Node.js 18.x does not provideFileglobally, causing the crash on startup.Changes
Version Requirements
engines.nodefrom>=18.15.0 <19.0.0 || ^20to>=20.0.0Documentation Updates
Breaking Change
Testing
After upgrading to Node.js v20+:
Server should start correctly at http://localhost:3000 without the
File is not definederror.