首页 > 解决方案 > 如何更改 npm 中的默认“作者”?

问题描述

每次新建npm项目时,作者名都写错了,可以改吗?

package name: (template) template
version: (1.0.0)
description:
entry point: (index.js) bot.js
test command:
git repository:
keywords:
license: (ISC)
About to write to:

{
  "name": "template",
  "version": "1.0.0",
  "description": "",
  "main": "bot.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "*wrong author*",
  "license": "ISC"
}

标签: npm

解决方案


您可以按照 Commond 运行

npm config set init.author.name "your name"

或转到 package.json 文件并编辑作者名称。

 package name: (template) template
    version: (1.0.0)
    description:
    entry point: (index.js) bot.js
    test command:
    git repository:
    keywords:
    license: (ISC)
    About to write to:

    {
      "name": "template",
      "version": "1.0.0",
      "description": "",
      "main": "bot.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "Rajneesh Shukla",
      "license": "ISC"
    }

推荐阅读