Skip to content

Detect and enforce Node Version in preinstall hook so pnpm fails clearly #4035

@Jolg42

Description

@Jolg42

Discussed from #3930
https://prisma-company.slack.com/archives/CEYCG2MCN/p1602759196130900

In the CLI in the preinstall hook we could use something like

const nodeVersions = process.version.split('.')
const nodeMajorVersion = parseInt(nodeVersions[0].slice(1))
const nodeMinorVersion = parseInt(nodeVersions[1])

if (nodeMajorVersion < 10) {
// exit with error

Yarn doesn't need this because Yarn reads the package.json and error if the Node version required doesn't match, while npm is supposed to print a warning only.

Metadata

Metadata

Assignees

Labels

good first issueAlways wanted to get involved in an open source project but don’t know where to begin? Welcome!kind/techA technical change.tech/typescriptIssue for tech TypeScript.topic: cli

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions