From 22cd7f43ade8224e29c380167c95e850270252f9 Mon Sep 17 00:00:00 2001 From: Pelle Wessman Date: Fri, 15 Oct 2021 12:51:41 +0200 Subject: [PATCH] Fix --lockfile-version to handle string number As all CLI input is considered to be string, eg. a "npm install --lockfile-version 3" otherwise fails with the error messages: npm WARN invalid config lockfile-version="3" set in command line options npm WARN invalid config Must be one of: null, 1, 2, 3 Replacing `1, 2, 3` with `Number` avoids that and eg. `--lockfile-version 6` will still fail later on with `npm ERR! Invalid lockfileVersion config: 6`, so this is in a way a more DRY approach as well. --- lib/utils/config/definitions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index c9806b3c2890f..a4e7339a353ae 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -1157,7 +1157,7 @@ define('location', { define('lockfile-version', { default: null, - type: [null, 1, 2, 3], + type: [null, Number], defaultDescription: ` Version 2 if no lockfile or current lockfile version less than or equal to 2, otherwise maintain current lockfile version