← 返回命令列表

Linux command

npm-edit 命令

文本

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

常用示例

Edit an installed package

npm edit [package]

Edit a nested subpackage

npm edit [package]/[subpackage]

Edit with a specific editor

EDITOR=[vim] npm edit [package]

Configure the default editor

npm config set editor [code]

说明

npm edit opens an installed package's directory in the default editor so it can be inspected or modified in place under `node_modules`. After the editor exits, npm rebuilds the package so any changes (for example to native addons) take effect. The editor is taken from the npm editor config, which defaults to the EDITOR or VISUAL environment variables (or `notepad.exe` on Windows, `vi` on Unix).

参数

/_subpkg_
Optional nested package path, to drill into a transitive dependency under `node_modules`.
editor (config)
Editor used to open the package. Set with `npm config set editor <name>` or via EDITOR/VISUAL.

FAQ

What is the npm-edit command used for?

npm edit opens an installed package's directory in the default editor so it can be inspected or modified in place under `node_modules`. After the editor exits, npm rebuilds the package so any changes (for example to native addons) take effect. The editor is taken from the npm editor config, which defaults to the EDITOR or VISUAL environment variables (or `notepad.exe` on Windows, `vi` on Unix).

How do I run a basic npm-edit example?

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

What does /_subpkg_ do in npm-edit?

Optional nested package path, to drill into a transitive dependency under `node_modules`.