默认值

中英双语

npm 将根据包内容默认一些值。

  • "scripts": {"start": "node server.js"}

    如果你的包根目录中有 server.js 文件,那么 npm 将默认 start 命令为 node server.js

  • "scripts":{"install": "node-gyp rebuild"}

    如果你的包的根目录中有一个 binding.gyp 文件并且你没有定义一个 installpreinstall 脚本,npm 将默认 install 命令使用 node-gyp 编译。

  • "contributors": [...]

    如果你的包的根目录中有一个 AUTHORS 文件,npm 会将每一行视为 Name <email> (url) 格式,其中 email 和 url 是可选的。以 # 开头或空白的行将被忽略。