{"record":{"id":"f9cdb6de1029023d","repo":"nodejs/node","slug":"the-basekey-option-is-deprecated-and-cannot","errorCode":null,"errorMessage":"The `${baseKey}` option is deprecated, and cannot be set in this way${deprecated}","messagePattern":"The `(.+?)` option is deprecated, and cannot be set in this way(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"deps/npm/lib/commands/config.js","lineNumber":174,"sourceCode":"        throw this.usageError()\n    }\n  }\n\n  async set (args) {\n    if (!args.length) {\n      throw this.usageError()\n    }\n\n    const where = this.npm.flatOptions.location\n    for (const [key, val] of Object.entries(keyValues(args))) {\n      log.info('config', 'set %j %j', key, val)\n      const baseKey = key.split(':').pop()\n      if (!this.npm.config.definitions[baseKey] && !nerfDarts.includes(baseKey)) {\n        throw new Error(`\\`${baseKey}\\` is not a valid npm option`)\n      }\n      const deprecated = this.npm.config.definitions[baseKey]?.deprecated\n      if (deprecated) {\n        throw new Error(\n          `The \\`${baseKey}\\` option is deprecated, and cannot be set in this way${deprecated}`\n        )\n      }\n\n      if (val === '') {\n        this.npm.config.delete(key, where)\n      } else {\n        this.npm.config.set(key, val, where)\n      }\n\n      if (!this.npm.config.validate(where)) {\n        log.warn('config', 'omitting invalid config values')\n      }\n    }\n\n    await this.npm.config.save(where)\n  }\n","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/npm/lib/commands/config.js#L156-L192","documentation":"Even when a key is a valid config option, if its definition carries a `.deprecated` marker it cannot be set via `npm config set`. The appended deprecation text explains why and points to the supported replacement.","triggerScenarios":"Setting an option that npm has marked deprecated in the current version (e.g. legacy options superseded by package-lock.json or new flags).","commonSituations":"Upgrading npm and re-running an old provisioning script; dotfiles that still configure obsolete behavior.","solutions":["Read the appended deprecation message and switch to the named replacement","Edit .npmrc manually only if the option still works there (check docs first)","Remove the setting entirely if the behavior is now the default"],"exampleFix":"# before\nnpm config set package-lock false\n\n# after (follow the deprecation note; e.g. rely on default lockfile behavior or use --no-package-lock per-command)","handlingStrategy":"validation","validationCode":"const def = npm.config.definitions[baseKey]\nif (def && def.deprecated) {\n  throw new Error(`Refusing to set deprecated ${baseKey}: ${def.deprecated}`)\n}","typeGuard":"function isDeprecatedOption(key, definitions) {\n  return Boolean(definitions[key.split(':').pop()]?.deprecated)\n}","tryCatchPattern":null,"preventionTips":["Re-validate config scripts after every npm major upgrade","Read deprecation notes in `npm help config` before provisioning","Track and remove obsolete options from dotfiles"],"tags":["config","deprecated","cli","npmrc"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}