mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-30 13:02:03 -04:00
18 lines
500 B
TypeScript
18 lines
500 B
TypeScript
import { detectIfCurrentPkgIsExecutable } from '@pnpm/cli-meta'
|
|
import mem from 'mem'
|
|
import * as execa from 'execa'
|
|
|
|
export function getSystemNodeVersionNonCached (): string | undefined {
|
|
if (detectIfCurrentPkgIsExecutable()) {
|
|
try {
|
|
return execa.sync('node', ['--version']).stdout.toString()
|
|
} catch {
|
|
// Node.js is not installed on the system
|
|
return undefined
|
|
}
|
|
}
|
|
return process.version
|
|
}
|
|
|
|
export const getSystemNodeVersion = mem(getSystemNodeVersionNonCached)
|