From 2812205bb3a9a3c391591a2f02113caa3aa37254 Mon Sep 17 00:00:00 2001 From: Ben Blank Date: Fri, 27 Sep 2019 11:04:44 -0700 Subject: [PATCH] Fix figgyPudding error in `npm token` It seems that a couple of lines were missed when token.js was [changed to use figgyPudding](https://github.com/npm/cli/commit/4cf850d2be118abce72b3cf533f13512e9844ad1#diff-398ed3b014436a5204583323ea29320b), which [causes an error](https://npm.community/t/npm-token-err-figgypudding-options-cannot-be-modified-use-concat-instead/10288) when trying to run that command in certain circumstances. This patch fixes that error. Tested locally by applying the patch to npm 6.11.3. --- lib/token.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/token.js b/lib/token.js index 9b1fbef9cecf4..b2c89b5ba2041 100644 --- a/lib/token.js +++ b/lib/token.js @@ -118,9 +118,10 @@ function config () { }) } else { conf = conf.concat({ auth: {} }) - conf.auth = {} } - if (conf.otp) conf.auth.otp = conf.otp + if (conf.otp) { + conf = conf.concat({ auth: { otp: conf.otp } }) + } return conf }