代码之家  ›  专栏  ›  技术社区  ›  Andrey Bushman

为什么package.json不使用.npmrc文件中的预定义值?

  •  0
  • Andrey Bushman  · 技术社区  · 6 年前

    Windows 10 x64

    相符合的 this C:\Users\bushm\.npmrc 包含内容的文件:

    author = "Andrey Bushman"
    

    npm init -y 我在中看到的新目录中的命令 package.json 财产 author 是空的:

    {
      "name": "foo",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "keywords": [],
      "author": "",
      "license": "ISC"
    }
    

    此外,我还通过命令完成了: npm config set author "Andrey Bushman" 但是我得到了同样的结果。。。

    1 回复  |  直到 6 年前
        1
  •  0
  •   Community Mohan Dere    5 年前

    我不认为author是npmrc文件支持的选项。
    请看一看 this documentation 获取可用选项。

    npm从命令行获取其配置设置, 环境变量和npmrc文件。

    npm config命令可用于更新和编辑 用户和全局npmrc文件。

    有关可用配置选项的列表,请参阅 npm-config

    推荐文章