npm token: ERR! figgyPudding options cannot be modified. Use .concat() instead.

What I Wanted to Do

Use npm token create --read-only.

What Happened Instead

$ npm token
npm ERR! figgyPudding options cannot be modified. Use .concat() instead.

Reproduction Steps

Attempt to run any npm token command.

Details

Full log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/home/simon/npm/bin/npm', 'token' ]
2 info using npm@6.11.3
3 info using node@v10.15.2
4 verbose npm-session 559f0695ab8ed3fd
5 verbose stack Error: figgyPudding options cannot be modified. Use .concat() instead.
5 verbose stack     at Object.set (/home/simon/npm/lib/node_modules/npm/node_modules/figgy-pudding/index.js:169:13)
5 verbose stack     at config (/home/simon/npm/lib/node_modules/npm/lib/token.js:121:15)
5 verbose stack     at list (/home/simon/npm/lib/node_modules/npm/lib/token.js:128:16)
5 verbose stack     at EventEmitter.token (/home/simon/npm/lib/node_modules/npm/lib/token.js:48:40)
5 verbose stack     at Object.commandCache.(anonymous function) (/home/simon/npm/lib/node_modules/npm/lib/npm.js:156:13)
5 verbose stack     at EventEmitter.<anonymous> (/home/simon/npm/lib/node_modules/npm/bin/npm-cli.js:131:30)
5 verbose stack     at process._tickCallback (internal/process/next_tick.js:61:11)
6 verbose cwd /home/simon/dc/cts
7 verbose Linux 4.19.0-6-amd64
8 verbose argv "/usr/bin/node" "/home/simon/npm/bin/npm" "token"
9 verbose node v10.15.2
10 verbose npm  v6.11.3
11 error figgyPudding options cannot be modified. Use .concat() instead.
12 verbose exit [ 1, true ]

I tried removing my .npmrc, but that made no difference.

Platform Info

$ npm --versions
{ npm: '6.11.3',
  ares: '1.14.0',
  cldr: '34.0',
  http_parser: '2.8.0',
  icu: '63.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.37.0',
  node: '10.15.2',
  openssl: '1.1.1b',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.24.1',
  v8: '6.8.275.32-node.12',
  zlib: '1.2.11' }
$ node -p process.platform
linux

I’ve had this problem on multiple machines and multiple versions of npm (e.g. 6.10.2, but probably others). I have never been able to run npm token anywhere without getting this error.

I’m encountering the same error when running npm token list on Node.js 10.16.3 and both npm 6.9.0 and 6.11.3. My debug.log is basically identical.

It looks like this is the result of an incomplete conversion to figgyPudding. After some local testing, I’ve created a PR which should resolve the issue.

In the mean time, you should be able to work around the issue by logging in (npm login) prior to running your npm token command.