Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
}
},
"engines": {
"node": ">=18.15.0 <19.0.0 || ^20",
"node": ">=20.0.0",
"pnpm": "^10.26.0"
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"email": "henryheng@flowiseai.com"
},
"engines": {
"node": ">=18.15.0 <19.0.0 || ^20"
"node": ">=20.0.0"
},
"license": "SEE LICENSE IN LICENSE.md",
"dependencies": {
Expand Down
8 changes: 8 additions & 0 deletions packages/server/src/commands/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ export abstract class BaseCommand extends Command {
async init(): Promise<void> {
await super.init()

const [major] = process.versions.node.split('.').map(Number)
if (major < 20) {
console.error(
`Error: Flowise requires Node.js v20 or later. You are running Node.js v${process.versions.node}.\nPlease upgrade Node.js: https://nodejs.org/`
)
process.exit(1)
Comment on lines +188 to +191
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better integration with the oclif framework, it's more idiomatic to use this.error() to handle this version check failure. This method is designed for reporting errors and exiting in an oclif command, providing consistent error formatting and improving testability by allowing this.error to be mocked. The Error: prefix is not needed as this.error() adds it automatically.

Suggested change
console.error(
`Error: Flowise requires Node.js v20 or later. You are running Node.js v${process.versions.node}.\nPlease upgrade Node.js: https://nodejs.org/`
)
process.exit(1)
this.error(
`Flowise requires Node.js v20 or later. You are running Node.js v${process.versions.node}.\nPlease upgrade Node.js: https://nodejs.org/`,
{ exit: 1 }
)

}

process.on('SIGTERM', this.onTerminate())
process.on('SIGINT', this.onTerminate())

Expand Down