From 5b579f16381b804435968b7cb2131868c08c0350 Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Wed, 27 Jul 2022 14:31:06 -0700 Subject: [PATCH] refactor: check volta first, then engine --- src/installer.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/installer.ts b/src/installer.ts index 028ecb8..e4dde61 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -502,10 +502,9 @@ export function parseNodeVersionFile(contents: string): string { if (!nodeVersion) { try { - // Try parsing the file as an NPM `package.json` - // file. - nodeVersion = JSON.parse(contents).engines?.node; - if (!nodeVersion) JSON.parse(contents).volta?.node; + // Try parsing the file as an NPM `package.json` file. + nodeVersion = JSON.parse(contents).volta?.node; + if (!nodeVersion)nodeVersion = JSON.parse(contents).engines?.node; if (!nodeVersion) throw new Error(); } catch (err) { // In the case of an unknown format,