当我执行npm install koa-compose
时,npm会自动添加一些带下划线的属性,它们有什么作用?像这样:
{
"_args": [
[
"koa-compose",
"/Users/keenwon/Desktop/demo"
]
],
"_from": "koa-compose@latest",
"_id": "koa-compose@2.4.0",
"_inCache": true,
"_installable": true,
"_location": "/koa-compose",
"_nodeVersion": "5.7.0",
"_npmVersion": "3.7.5",
"_phantomChildren": {},
"_spec": "koa-compose",
"_where": "/Users/keenwon/Desktop/demo"
"version": "2.4.0"
}
答案 0 :(得分:1)
这是What are these properties prefixing underscore used for in package.json?的副本 答案:https://stackoverflow.com/a/42625703/6307425
这些是为包注册表保留的元数据。所有以_或$开头的属性都保留给包注册表以供其自行决定使用。 wiki常见的“保留属性”部分解释了它。