We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c90afab commit 0aecd56Copy full SHA for 0aecd56
dist/setup/index.js
@@ -62682,8 +62682,16 @@ function translateArchToDistUrl(arch) {
62682
}
62683
function parseNodeVersionFile(contents) {
62684
let nodeVersion = contents.trim();
62685
- if (/^v\d/.test(nodeVersion)) {
62686
- nodeVersion = nodeVersion.substring(1);
+ try {
+ // assume all content parseable as JSON is a valid,
62687
+ // npm package.json file
62688
+ nodeVersion = JSON.parse(nodeVersion).engines.node;
62689
+ }
62690
+ catch (err) {
62691
+ // if not, assume it is a node version file
62692
+ if (/^v\d/.test(nodeVersion)) {
62693
+ nodeVersion = nodeVersion.substring(1);
62694
62695
62696
return nodeVersion;
62697
0 commit comments