← 返回命令列表

Linux command

npm-pkg 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Get package.json field

npm pkg get [name]

Set package.json field

npm pkg set [name]="[value]"

Delete field

npm pkg delete [field]

Get multiple fields

npm pkg get [name] [version]

Set nested field

npm pkg set [scripts.test]="[jest]"

说明

npm pkg manipulates package.json fields. Read and write properties programmatically. The command modifies package.json. Useful for scripts and automation.

参数

get _FIELD_
Read field value.
set _FIELD=VALUE_
Write field value.
delete _FIELD_
Remove field.
--help
Display help information.

FAQ

What is the npm-pkg command used for?

npm pkg manipulates package.json fields. Read and write properties programmatically. The command modifies package.json. Useful for scripts and automation.

How do I run a basic npm-pkg example?

Run `npm pkg get [name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does get _FIELD_ do in npm-pkg?

Read field value.