feat(create-medusa-app, medusa): check Node.js version before installation. (#8452)

Check before installation with `create-medusa-app` and `medusa new` whether the current node version is >= 20. If not, exit with an error.
This commit is contained in:
Shahed Nasser
2024-08-06 10:15:17 +03:00
committed by GitHub
parent 413e29837c
commit 98f42e8995
6 changed files with 24 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ import { getPackageManager, setPackageManager } from "../util/package-manager"
import { PanicId } from "../reporter/panic-handler"
import { clearProject } from "../util/clear-project"
import path from "path"
import { getNodeVersion, MIN_SUPPORTED_NODE_VERSION } from "@medusajs/utils"
const removeUndefined = (obj) => {
return Object.fromEntries(
@@ -512,6 +513,11 @@ const attemptSeed = async (rootPath) => {
* Main function that clones or copies the starter.
*/
export const newStarter = async (args) => {
const nodeVersion = getNodeVersion()
if (nodeVersion < MIN_SUPPORTED_NODE_VERSION) {
reporter.error(`Medusa requires at least v20 of Node.js. You're using v${nodeVersion}. Please install at least v20 and try again: https://nodejs.org/en/download`)
process.exit(1)
}
track("CLI_NEW")
const {